Shared libraries

Doug Gwyn gwyn at smoke.BRL.MIL
Tue Jan 9 09:48:24 AEST 1990


In article <941 at targon.UUCP> ruud at targon.UUCP (Ruud Harmsen) writes:
>What exactly are shared libraries?  What UNICes have them?  Does it mean that
>frequently used libraries are no longer compiled into the executable, but
>reside only in the library?  Does this save space on disk, or also at
>runtime, in core?  Can you do it only with standard libraries, or also with
>your own?  Is it any slower or faster than the normal way?

You seem to have the right notion already.  Shared libraries are pretty
much standard on UNIX System V Release 3 and later, as well as on some
UNIX-based systems for small (PC-like) environments.  Space is definitely
saved on disk and in general main memory demand is also reduced.  Users
can generally create their own shared libraries, but you need to work
hard at doing it right, since the initial interfaces cannot be changed
later without recompiling EVERY application that used the shared library.

There is a very slight added cost in calling a shared library function,
but it is almost always repaid by the overall reduced load on the system.

One implementation technique is for there to be a vector of standard
(shared) function pointers in a segment that is mapped at execution
time into the same virtual space as the shared library implementation's
vectors.  Because the vectors are always at the same address, the library
can be improved without requiring that existingt applications be relinked.



More information about the Comp.unix.questions mailing list