From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,b772008669734662 X-Google-Attributes: gidfee84,public From: metsky@telemark.zk3.dec.com (David Metsky) Subject: Re: shared libraries Date: 1995/05/22 Message-ID: <3pqcvs$seo@lead.zk3.dec.com>#1/1 X-Deja-AN: 103111475 distribution: world references: <3pq4go$765@info.epfl.ch> organization: Digital Equipment Corporation reply-to: metsky@zk3.dec.com (David Metsky) newsgroups: comp.unix.osf.osf1 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