Chameleon <[EMAIL PROTECTED]> writes: > So the question is why linker include useless binary objects to final > binary executable.
Because you told it to do so. When you link with g++ main.o foo.o bar.o baz.o -laaa -lbbb -lccc then linker is *not allowed* to remove foo.o, bar.o and baz.o from the link [1]. Contrast this with: ar ruv libfoobarbaz.a foo.o bar.o baz.o g++ main.o -lfoobarbaz -laaa -lbbb -lccc Now the linker can remove foo.o etc. from the link if they are not referenced by main.o More info here: http://webpages.charter.net/ppluzhnikov/linker.html Cheers, [1] Some linkers (most notably AIX) ignore what you *explicitly* told them to do, and do what they think is "right". Quite often what they think is "right" is actually wrong, and tools that think they are smarter than the programmer are the first ones to be against the wall when the revolution comes. -- 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