The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: RedXVII on December 06, 2006, 10:58:41 PM

Title: Unused Procs in Include files
Post by: RedXVII on December 06, 2006, 10:58:41 PM
Is there anyway of getting masm to EXCLUDE proc's that are in my include files that arent called/needed?

Scenario: Ive have an include file with a few common functions in them for win32 programming, I include it in my new project in order to use ONE of the functions from it. But masm being clever (but somewhat not clever in this case) includes the other unused functions aswell. Is there an easy solution besides deleting them?

Cheers
RedXVII  :U
Title: Re: Unused Procs in Include files
Post by: hutch-- on December 06, 2006, 11:08:27 PM
red,

The only solution is basically to seperate equate, prototype and struct/union data from runtime code and you will never have the problem. You can have the code within a MACRO and this will not be added if you don't call the macro but if you have open procedures in include file data, it gets added to your exe if you call the include. Maybe try something like this.

EnableMyCode MACRO
.const
MyCode PROTO args etc ....
.code
MyCode proc args etc ....
  ; your code here
MyCode endp
ENDM
Title: Re: Unused Procs in Include files
Post by: u on December 06, 2006, 11:50:09 PM
The only good solution is to put the procs in a .lib, after separating them into different .asm (thus  .obj) files. The linker then will be intelligent enough to link only the .obj's (procs) that you currently use.