LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-08-2010, 07:56 AM   #1
sebelk
Member
 
Registered: Jan 2007
Posts: 66

Rep: Reputation: 15
Question about shared libraries


Let's say that we have a program /bin/foo that is linked against /usr/lib/libfoo.so.

Let's say that /usr/lib/libfoo.so was compiled against /usr/lib/libsomething.so and /usr/lib/libsomeotherthing.so

How can I know if library is using dynamic loading?

I mean: how can I know if foo is only using functions from either /usr/lib/libsomeotherthing.so or /usr/lib/libsomething.so when it's needed (on demand)?

Thanks in advance!
 
Old 10-08-2010, 10:46 AM   #2
rob.rice
Senior Member
 
Registered: Apr 2004
Distribution: slack what ever
Posts: 1,076

Rep: Reputation: 205Reputation: 205Reputation: 205
ldd prints the shared libraries required by each program or shared library specified on the command line
 
Old 10-08-2010, 11:33 AM   #3
sebelk
Member
 
Registered: Jan 2007
Posts: 66

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by rob.rice View Post
ldd prints the shared libraries required by each program or shared library specified on the command line
Thanks! I knew that! But I'am interested of get libraries that use dynamic loading
 
Old 10-08-2010, 12:11 PM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
From the man page of ldd:
Quote:
ldd prints the shared libraries required by each program or shared library specified on the command line.
(emphasis added)

So, as an example:
Code:
$ ldd /bin/ls
	linux-gate.so.1 =>  (0xb7859000)
	librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb7837000)
	libselinux.so.1 => /lib/libselinux.so.1 (0xb781c000)
	libacl.so.1 => /lib/libacl.so.1 (0xb7813000)
	libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb76b9000)
	libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb76a0000)
	/lib/ld-linux.so.2 (0xb785a000)
	libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb769c000)
	libattr.so.1 => /lib/libattr.so.1 (0xb7696000)
$ ldd /lib/libattr.so.1
	linux-gate.so.1 =>  (0xb785f000)
	libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb76e6000)
	/lib/ld-linux.so.2 (0xb7860000)
Also, the naming convention of libraries is that *.so libraries are dynamically linked whereas *.a libraries are statically linked. However, the only way that I know of to verify that a library uses dynamic linking is to use ldd as shown above.

Last edited by Dark_Helmet; 10-08-2010 at 12:14 PM.
 
  


Reply

Tags
dynamic, library, shared


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
New to Linux - Question about shared libraries and makefiles ETCKerry Linux - Newbie 5 06-17-2009 08:29 AM
Urgent !!! rpm: error while loading shared libraries: libelf.so.1: cannot open shared tinaa Linux - Software 5 12-02-2008 03:19 PM
error while loading shared libraries: libstdc++.so.5: cannot open shared object file PaulyWally Debian 2 10-18-2008 05:59 PM
shared libraries question rhb327 Slackware 2 09-23-2005 10:49 AM
Shared libraries question...need help tarballed Linux - General 3 03-15-2003 01:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:01 AM.

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