I have 2 static libraries,
libalgha.a with 2 functions: func1() and func2()
and
libbeta.a with 2 functions: func3() and func4()
I have 1 executable (mytest) linked with these 2 libs. The executable calls only func1() and func3(). So as I understand the linker will put only the symbol of these 2 functions into the executable.
The executable is loading with dlopen() in runtime a shared library (libgamma.so) and this shared library uses the function func2() from libalgha.a. When running mytest I get the error:
symbol func2: referenced symbol not found
I can’t include libalgha.a inside libgamma.so because of a Solaris 32/64 bits issue.
So how can I link mytest with all symbols of libalgha.a ?
Include a reference to
func2in your program source like:Alternatively, link the whole library into one object, using
ld -r, and link that object to the executable, instead of the library. You may or may not need to extract objects, e.g., if the following does not work:then do