[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Linking only required objects
From: |
Colin S. Miller |
Subject: |
Re: Linking only required objects |
Date: |
Mon, 05 Jun 2006 20:54:41 +0100 |
User-agent: |
Debian Thunderbird 1.0.2 (X11/20060423) |
Bernhard Mogens Ege wrote:
I try to link only required objects into my executable but I dont know
which objects are required so I add lots of -l<library> to my linker
stage (using gnu ld). My program is linked and runs. Fine. But checking
with ldd I see that it now depends on all these libraries, some of them
I am sure are not required.
How do I find out which libraries are required and which are not required?
Bernhard,
You can use 'nm' (name) or 'objdump' to list the functions that a library
provides.
It is generally recommend not to call 'ld' directly, instead you use 'gcc'
to do the link - it will add libc (and libstdc++ if called as gpp).
HTH,
Colin S. Miller
--
Replace the obvious in my email address with the first three letters of the
hostname to reply.