file size and #include
-
noob question (tools: eVC++ w/ppc2k2 sdk)... if header files are #include'd but the functions from their corresponding libraries never called, does the final compiled file include the unused functions thereby increasing file size? fyi, the issue i'm trying to better understand is whether i #include windows.h or a subset. tia..
-
noob question (tools: eVC++ w/ppc2k2 sdk)... if header files are #include'd but the functions from their corresponding libraries never called, does the final compiled file include the unused functions thereby increasing file size? fyi, the issue i'm trying to better understand is whether i #include windows.h or a subset. tia..
Most of the functions declared in these #includes are implemented in DLLs. System DLLs are in ROM, so this is irrelevant for the final size of your application. Regards, João Paulo
-
Most of the functions declared in these #includes are implemented in DLLs. System DLLs are in ROM, so this is irrelevant for the final size of your application. Regards, João Paulo
thanks and it makes sense for functions implemented in DLLs. two followup ?'s: 1) what about the case where the unused functions are implemented in static libraries? are these unused fcn's compiled in even if they're not called? 2) is there a straightforward way when looking at the wince header files to determine if the api is implemented in a DLL or a static library? thanks!
-
thanks and it makes sense for functions implemented in DLLs. two followup ?'s: 1) what about the case where the unused functions are implemented in static libraries? are these unused fcn's compiled in even if they're not called? 2) is there a straightforward way when looking at the wince header files to determine if the api is implemented in a DLL or a static library? thanks!
rodent¹ wrote: 1) what about the case where the unused functions are implemented in static libraries? are these unused fcn's compiled in even if they're not called? Depends on your linker, but the general answer is yes. rodent¹ wrote: 2) is there a straightforward way when looking at the wince header files to determine if the api is implemented in a DLL or a static library? Unfortunately, no. Regards, João Paulo
-
rodent¹ wrote: 1) what about the case where the unused functions are implemented in static libraries? are these unused fcn's compiled in even if they're not called? Depends on your linker, but the general answer is yes. rodent¹ wrote: 2) is there a straightforward way when looking at the wince header files to determine if the api is implemented in a DLL or a static library? Unfortunately, no. Regards, João Paulo
For #1: The linker supplied with eVC will remove unused packages (called COMDATs in the documentation) if the
/OPT:REF
switch is turned on. This is turned on by default, unless the/DEBUG
switch is enabled, in which case it's turned off. To force the linker to remove unreferenced functions, the compiler must be instructed to package each function in its own COMDAT. You do this by specifying the/Gy
option to the compiler (called 'Enable function-level linking' in the 'Customize' category of the Project Settings dialog). If this option is not enabled, the linker can only include or exclude individual object files. A static library basically consists of multiple object files with a header describing what's in it. From memory, Microsoft's static libraries are compiled with this option enabled.