From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5078 invoked by alias); 24 Jul 2008 20:23:39 -0000 Received: (qmail 5002 invoked by uid 22791); 24 Jul 2008 20:23:39 -0000 X-Spam-Check-By: sourceware.org Received: from exprod6og105.obsmtp.com (HELO exprod6og105.obsmtp.com) (64.18.1.189) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 24 Jul 2008 20:23:19 +0000 Received: from source ([192.150.8.22]) by exprod6ob105.postini.com ([64.18.5.12]) with SMTP; Thu, 24 Jul 2008 13:18:35 PDT Received: from inner-relay-1.corp.adobe.com ([153.32.1.51]) by outbound-smtp-2.corp.adobe.com (8.12.10/8.12.10) with ESMTP id m6OKIXE0012763; Thu, 24 Jul 2008 13:18:34 -0700 (PDT) Received: from apacmail.pac.adobe.com (apacmail.pac.adobe.com [130.248.36.99]) by inner-relay-1.corp.adobe.com (8.12.10/8.12.10) with ESMTP id m6OKIViq029705; Thu, 24 Jul 2008 13:18:32 -0700 (PDT) Received: from namailgen.corp.adobe.com ([10.8.192.91]) by apacmail.pac.adobe.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 25 Jul 2008 05:18:31 +0900 Received: from 10.7.234.18 ([10.7.234.18]) by namailgen.corp.adobe.com ([10.8.192.91]) via Exchange Front-End Server namail.corp.adobe.com ([10.8.189.98]) with Microsoft Exchange Server HTTP-DAV ; Thu, 24 Jul 2008 20:18:29 +0000 User-Agent: Microsoft-Entourage/12.11.0.080522 Date: Thu, 24 Jul 2008 20:51:00 -0000 Subject: Re: link shared library against another shared library From: Eljay Love-Jensen To: qcp , GCC-help Message-ID: In-Reply-To: <18639001.post@talk.nabble.com> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-07/txt/msg00268.txt.bz2 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