This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: link shared library against another shared library


Hi qcp,

> I have a shared library A which uses shared library B, and an application P
> which relies on A.
> 
> I don't want to link P against A and B, but to link P against A only, and A
> against B (and somehow hide B to P)
> 
> How can I do ?
> 
> The shared libraries are generated with 'g++ -shared...'
> 
> Thanks for your answers

g++ -o P P.cpp -lA

That will make P directly dependent on libA.so, and not directly dependent
on libB.so (although it is indirectly dependent on libB.so, via libA.so).

You can use...  ldd P  ...to display the dependencies.  Depending on your
ldd, it may-or-may-not show indirect dependencies as well.  Check your
platform's "man ldd" for relevant flags.

HTH,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]