Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-24-2008, 04:14 PM   #1
LQ Newbie
Registered: Jul 2008
Posts: 2

Rep: Reputation: 0
gcc link shared library against another shared library

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
Old 07-25-2008, 12:15 PM   #2
Registered: Jun 2008
Posts: 101

Rep: Reputation: 15
You have to compile your shared library A first and install to a location contained in your path (/usr/local/lib for example). From that point on build your application using shared library A. Your application doesn't need to know that one of it's libraries uses other libraries as well.

I'm not sure, but I think that 'ldd' will reveal anyway all dependencies, so library B might show up on the list as well.

Is this needed for some workaround due to licensing issues, or is the client not supposed to know that parts of the code are using some external code?

Linux Archive

Last edited by FranDango; 09-20-2008 at 07:22 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
list library function of a shared library .so powah Linux - General 7 10-25-2011 05:47 AM
Link shared library in Kdevelop neikinfology Linux - Software 0 07-12-2007 04:35 AM
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-05-2007 12:11 AM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 05:20 AM
gcc 3.3.2, shared library luzi82 Debian 2 12-21-2003 10:35 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:31 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration