Resolving symbols in dependent libraries

Andrew Bell andrew.bell.ia@gmail.com
Wed Aug 19 15:58:00 GMT 2015


Hi,

Say I have two shared libraries, a.so and b.so.  a.so depends on b.so
and links it in when it is built.  Say that b.so contains the symbol
B.  In my program I call B() directly.

I'd like to be able to link my program by just referring to a.so, and
have it know to look in b.so to resolve B():

g++ foo.cpp -l a

Right now it seems I have to do:

g++ foo.cpp -l a -l b

in order to get B() resolved.  Is there a way to do this.  Am I doing
something wrong so that the dependent library isn't searched
automatically?

Thanks,

-- 
Andrew Bell
andrew.bell.ia@gmail.com



More information about the Binutils mailing list