Hi,

first of all, Maett and Paul, thank you very much for your replies!  :-)

Paul Pluzhnikov wrote:
I guess what happens is that when the linker links the executable, it
removes all symbols from libcfsLib.a that are unused by the
executable.

Not quite: the linker doesn't remove anything from anywhere; it
simply doesn't pull in the objects that it doesn't need.

Ah, okay. ;) My thought was that it first just duplicates or "concatenates" everything that I specify on the command line in scratch memory, then does a "flood fill" to flag everything that is needed, and finally creates the final executable by removing the non-flagged parts from scratch memory again. So as your text about linkers makes clear, my assumption that executables are entirely pre-built in (scratch) memory was somewhat wrong.

You may wish to read this for an explanation:
 http://webpages.charter.net/ppluzhnikov/linker.html

If you only care about GNU ld, the --whole-archive is a good
solution. If you care about portability to other linkers, use
multiple '-u needed_symbol_1' ...

If there are too many needed symbols, another alternative is to
create an object file which will "pull" them all in:

Great!  Many thanks for your detailed answer!

Best,
Carsten



--
Ca3D - Engine    http://www.Ca3D-Engine.de
Carsten Fuchs    http://www.Ca3D-Engine.de/c_Carsten.php
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to