Reputation: 163
For example, I have 3 different instances:
Am I right that linker can resolve all this symbols when I'll try to compile and link all this stuff together?
Main point of my worry is symbol "get_object". Can linker resolve such references between shared and static libraries?
Upvotes: 1
Views: 968
Reputation: 1
Static libraries are just an agglomeration of object files (their members), perhaps with a ranlib(1) generated index.
On Linux, if you link an object file (3) foo.o
with a static library (2) libee.a
and a shared library (1) libyz.so
and if you pass -rdynamic
at link time (i.e. gcc -rdynamic foo.o libee.a libyz.so -o myprog
or gcc -rdynamic foo.o -lee -lyz -o myprog
) then dynamic linker would resolve the get_object
name at dynamic link time (in ld-linux.so
)
Details are explained in ELF wikipage and Drepper's paper: How To Write Shared Libraries. Read also Levine's book: Linkers and loaders & ld(1) man page.
Upvotes: 2