Michael Kilburn <[EMAIL PROTECTED]> writes:

> And indeed executable size was decreased to ~32Mb. But still it is
> wrong -- I have created simple application that just calls empty
> function from one of these libraries:
> int main()
> {
>     foo(); // foo's body is empty
> }
>
> resulting image size was ~17Mb. If you comment out this call image
> size = 5kb.

If the file that was pulled in (the one defining empty foo()),
contains any global objects, then the constructors for such objects
are pulled in, anything that these constructors reference is pulled
in, etc. etc.

The constructors can not be garbage-collected, because they are
referenced from static_initialization_and_destruction().

Try putting 'int foo() { return 0; }' into a separate source file,
and adding the corresponding object file into the archive. I bet
you'll end up with a 5K exe file again.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to