Static Link with Shared Object
Oliver Fromme
olli at lurza.secnetix.de
Thu Dec 28 08:38:50 PST 2006
Jason C. Wells wrote:
> Does linking to a shared object cause the new object file to be shared also?
Yes. As soon as a single shared object is involved, the
runtime linker comes into play. To produce a truely static
binary -- if that's what you want --, you must use all
static libraries (*.a, not *.so), and use the -static flag.
Of course you can produce a dynamic executable with some
libraries linked statically. For example, it might make
sense to link against the shared libc, but with static
kerberos libraries.
> I am especially curious how the links to /usr/local are being found when
> I haven't used -L/usr/local.
ldconfig(8).
The -L flags tell the compiler and (compile-time) linker
ld(1) where to find the libraries. To actually find
shared libraries at run-time, the runtime-linker rtld(1)
uses the information stored by ldconfig(8).
Please refer to the manual pages mentioned above for
details.
Best regards
Oliver
--
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.
I suggested holding a "Python Object Oriented Programming Seminar",
but the acronym was unpopular.
-- Joseph Strout
More information about the freebsd-chat
mailing list