This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: link shared library against another shared library
- From: Eljay Love-Jensen <eljay at adobe dot com>
- To: qcp <qc_pham at yahoo dot fr>, GCC-help <gcc-help at gcc dot gnu dot org>
- Date: Thu, 24 Jul 2008 15:18:25 -0500
- Subject: 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