Why is -rdynamic not exporting the symbols in .a files but is exporting the symbols in .o files ?
I have an app and a plug-in in a .so file. The main app is linked using a series of object files and one static library, like this:
CXXFLAGS = $(CXXFLAGS_COMMON) -rdynamic
STATICLIBS = ../Utilities/Utilities.a
...
all:
$(CXX) $(CXXFLAGS) -o $(SAMPLE) main.o $(STATICLIBS) $(SHAREDLIBS) $(INCLUDES)
(CXX is g++ 4.5.2 on Ubunut, I use mainly -std=c++Ox for compilation)
In this case, the symbols in Utilities.a are not exported (i.e. "objdump -t a.out | grep symbol" is empty).
If I use "ar x" to extract the .o files in the .a and link using only the .o's, then the symbols are exported and found by the plug-ins (that are loaded with dlopen in case you wondered).
I have tried using -Wl,-export-dynamic but without success.
I do have a workaround, as mentionned, but I'd still wish to understand what I am missing. Thanks in advance !