Carsten Fuchs <[EMAIL PROTECTED]> writes:

> 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.

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:

void needed_symbol_1();
void needed_symbol_2();
...
void not_called()
{
    needed_symbol_1();
    needed_symbol_2();
    ...
}

[You'll have to explicitly list that "dummy" object on the link line.]

> Thus, is there a way to make the linker *not* remove some or all
> unused symbols somehow? Isn't that the supposed purpose of the
> --export-dynamic parameter?

No: --export-dynamic has totally different meaning and purpose.

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