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: Chris Pressey <cpressey@xxxxxxxxxxxxxxx>
Date: Sat, 15 Jan 2005 11:52:32 -0800

On Sat, 15 Jan 2005 10:40:31 -0800
walt <wa1ter@xxxxxxxxxxxxx> wrote:

> Context:  I told Joerg I would work on a port override for the
> ksysguard component of  kdebase3.  As expected, I'm running up
> against my own ignorance of how the dynamic library system works.
> I've modified the C code in ksysguard to use kinfo.h instead of
> dkstat.h (per Joerg's instructions).  The modified code compiles
> and installs without error.
> What mystifies me is that the installed program is *not* linked
> against the necessary libkinfo.so.  The reason is no mystery:
> I never modified any Makefile or linker flags which would do
> the necessary linking.
> The mystery (to me, at least) is why the whole build completes
> *without* libkinfo (???)
> 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.

It's a pain sometimes, I know... :/

You'll need to pass -lkinfo somewhere in some Makefile -- look for other
-l flags, that should be a pretty good clue.


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