Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 01 Sep 1998 21:35:33 -0700
From:      John Polstra <jdp@polstra.com>
To:        Mike Smith <mike@smith.net.au>
Cc:        chuckr@glue.umd.edu, current@FreeBSD.ORG
Subject:   Re: E-day problems: rtld-elf dlsym() broken? 
Message-ID:  <199809020435.VAA18125@austin.polstra.com>
In-Reply-To: Your message of "Tue, 01 Sep 1998 21:24:13 -0000." <199809012124.VAA00386@word.smith.net.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
> Given that the goal here seems to be able to use dlopen to load
> modules into an otherwise self-contained executable, would it be
> more correct to suggest that the executable should be linked shared,
> but against a static copy of the C library?

I don't think that will work either, in general.  The trouble is,
when you link against a static library, only the modules actually
used by the program are linked in.  The other ones don't appear
in the linked program at all.  If you dlopen a shared object that
needs some additional libc functions, it won't be able to find them.
You might be able to work around it by linking the executable with
"--whole-archive" to the linker, or some such nonsense.  But that
would make your executable very large.

> If this is correct, what's the "polite" way to explicitly reference
> libc?

If you dlopen "libc.so.3" (a name without any slash characters) then
the dynamic linker will search in all the usual places.  That's the
politest way I can think of.

John
--
   John Polstra                                       jdp@polstra.com
   John D. Polstra & Co., Inc.                Seattle, Washington USA
   "Self-knowledge is always bad news."                 -- John Barth

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809020435.VAA18125>