Victor said:
I have checked the switch General/WPO (if I understood it correctly, it
stays for Whole Programm Optimization). Indeed, there were differencies
between the both Debug and Release versions : Debug had 'No Whole
Programm Optimization', during Release had 'Use Link Time Code
Generation'.
Yes, I'm sorry WPO = Whole Program Optimization. In this case
the actual code generation is deferred to link time. It therefore enables
the compiler to do optimizations that require information from all
translation units (for instance inlining a function that is implemented
in another .cpp file)
WPO can reduce the code size (for the final EXE or DLL), but
modern desktop compilers are probably more geared for faster
code.
Well, I changed the switch for Release to 'No WPO' either. This has
brought an immediate effect : the size of the .LIB file reduced to a
fifth ! (BTW - I meant always the real size of final linked file). It
Just to make sure. The .lib file is _not_ the final linked file. Only
EXE or DLL are.
is still fast 500 MB, nevertheless!
I take it you mean KB. Otherwise it would really be a lot.
I'm not sure however, you fully understand what's going on.
The .lib is just a container for all object files (much like a tar
file or a zip file without the compression).
You said, you didn't add any source file yourself. So you'll
probably only have the MFC include files. These contain
inline functions and global data. Inline functions are only
emitted if referenced. So you'll probably only have data
symbols.
When you link your EXE or DLL the linker automatically
includes all object file you give on the command line.
Object files from .libs, however, will only be pulled in
if they contain a definition of a symbol that is referenced
by your code. That is, if you create a "Hello World" project
it doesn't matter if you link with a 100MB .lib or not - so long
as no symbols of the library are referenced.
Things get a bit more complicated with C++ code (which
uses COMDAT sections).
If you want a small image, make sure you build your lib
(or actually all of your code) with /Gy and link with /OPT:REF.
Again, only the size of your EXE or DLL is relevant.
-hg