From: metsky@telemark.zk3.dec.com (David Metsky)
Subject: Re: shared libraries
Date: 1995/05/22 [thread overview]
Message-ID: <3pqcvs$seo@lead.zk3.dec.com> (raw)
In-Reply-To: 3pq4go$765@info.epfl.ch
In the first compile
cc -o testtata -L. test.c -ltata
you specifically linked libc.a so you got the static case.
In the second compile
cc -o testc -L. test.c -lc
you let the linker find the right version of libc. It looks for the shared
version first in /usr/shlib and since it found it, that's what you got.
>Obviously libtata is the exact same thing as libc. Why is libc dynamically
>linked whereas libtata is statically linked ? What's the point of .so libraries
>then ?
libtata.a is the same as /usr/lib/libc.a, not the same as /usr/shlib/libc.so.
Your compile said to look in . first for libraries, and it found libtata.a
which is a link to /usr/lib/libc.a so that's what you got. If you created
a libtata.so and made a symbolic link to /usr/shlib/libc.so, you would have
gotten the shared library.
By default, when a library is included on the link line by -lxxx, the linker
will look for the shared library first, and the static library second. There
is a list of directories to scan for the library and /usr/shlib is the
first place it looks. If you put a specific file on the link line, the
linker will take that.
--
David Metsky Digital UNIX Software Group metsky@zk3.dec.com
--
David Metsky Digital UNIX Software Group metsky@zk3.dec.com
next prev parent reply other threads:[~1995-05-22 4:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-05-22 4:00 shared libraries Stefan Monnier
1995-05-22 4:00 ` David Metsky [this message]
-- strict thread matches above, loose matches on Subject: below --
1998-09-17 4:00 Shared libraries Peter Thornewell
1998-09-18 4:00 ` Nikola Milutinovic
1998-09-18 4:00 ` Scott J. Tringali
1994-06-29 6:08 Emmett McLean
[not found] ` <jerry.772874169@kenya>
1994-06-29 14:37 ` Burkhard Neidecker-Lutz
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox