Dumb linker/loader question

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Sat Jan 15 13:02:23 PST 2005


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.  It doesn't even try to link in
.so's at compile-time - it just takes it on faith that the functions
that you've said will be there (by including a header file) will in 
fact
be there - so it doesn't know there are unresolved symbols (missing
dependencies) until later, so everything builds without a hitch.
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
--
/"\
\ /
 \     ASCII Ribbon Campaign
/ \  Against HTML Mail and News
Attachment:
PGP.sig
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00002.pgp
Type: application/octet-stream
Size: 186 bytes
Desc: "Description: This is a digitally signed message part"
URL: <http://lists.dragonflybsd.org/pipermail/users/attachments/20050115/293bcf1b/attachment-0015.obj>


More information about the Users mailing list