DragonFly BSD
DragonFly users List (threaded) for 2005-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: Dumb linker/loader question


From: walt <wa1ter@xxxxxxxxxxxxx>
Date: Sun, 16 Jan 2005 04:29:34 -0800

Max Okumoto wrote:
Simon 'corecode' Schubert wrote:

On 15.01.2005, at 20:52, Chris Pressey wrote:

I'm clearly lacking some basic understanding of how this whole
thing works.  How can code that uses the header files from a
library compile *and* link successfully without that library?

In brief: because linking to shared objects (.so's) happens only when
the program is loaded, i.e. at runtime...

I think that's not 100% true. It won't work with executables because the linker indeed looks for the functions, if they exist in the shared object you're linking to. But it can't do so if you build a shared objects yourself. Then it just takes it for granted that the functions you are referring to will be present at load time.

cheers
  simon

The linker (/usr/bin/ld) need either a foo.a or a foo.so file. The header is not sufficent. There must be a library laying around in your
link path. Try and run ldd on the binary and see what it thinks it is
using.

Yours responses led me to the problem (which is obvious now, of course).


Thanks for the great help!  Meanwhile, I notice that Roland already
finished the override for me -- but I'm amazed how much of it I got
right -- I just left some things out ;o)



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]