public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* link shared library against another shared library
@ 2008-07-24 20:42 qcp
  2008-07-24 20:51 ` Eljay Love-Jensen
  0 siblings, 1 reply; 2+ messages in thread
From: qcp @ 2008-07-24 20:42 UTC (permalink / raw)
  To: gcc-help


Hi all,

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
-- 
View this message in context: http://www.nabble.com/link-shared-library-against-another-shared-library-tp18639001p18639001.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: link shared library against another shared library
  2008-07-24 20:42 link shared library against another shared library qcp
@ 2008-07-24 20:51 ` Eljay Love-Jensen
  0 siblings, 0 replies; 2+ messages in thread
From: Eljay Love-Jensen @ 2008-07-24 20:51 UTC (permalink / raw)
  To: qcp, GCC-help

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-24 20:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-24 20:42 link shared library against another shared library qcp
2008-07-24 20:51 ` Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).