Hello all,

I've written an executable and a .so shared library, and the executable dlopen()s the shared library during runtime.

The executable has been linked with
    g++ ... -lcfsLib -Wl,-rpath,. -Wl,--export-dynamic

where the libcfsLib.a contains symbols that are supposed to be referenced by the dlopen()ed shared library later.

However, my call to dlopen() returns with an error message about an undefined symbol that I would have expected to be provided by libcfsLib.a.


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. As a consequence, when dlopen() is called with the shared object that needs the previously removed symbol in the executable, it is not found. grep'ing the output of nm for the executable doesn't list the missing symbol either.

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?

Thank you very much, and best regards,
Carsten
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to