shared libraries, when to use them

Guy Harris guy at auspex.auspex.com
Tue Jun 25 03:29:40 AEST 1991


>So, if I understand SunOS and its shared libraries (and it's possible
>I don't.)  The shared libraries are created with the link editor, and
>one monolithic binary "library" is created.

True.

>Later, at run-time, if a reference to one symbol in a SunOS shared
>library causes the whole image to be loaded into memory (unused
>sections may be paged out later)

Unless somebody screwed up in making the library, that does *not*
happen.  The entire image is mapped into the virtual address space of
the process, but the pages of that image are pulled into physical memory
only on demand; unless the run-time loader has to relocate something on
every page (if it does, as indicated, somebody screwed up), not every
page gets pulled in.

>Two questions come to mind, one easy, one hard:
>
>How do SV.[34] shared libraries differ from SunOS shared libraries?

The first question to ask might be "How do SV.3 shared libraries differ
from SV.4 shared libraries?"

SV.3 shared libraries are allocated a fixed location in virtual address
space when they're built, and you have to go through some effort to
modify the source of the library routines to make them work.

SV.4 shared libraries are derived from SunOS 4.x shared libraries; they,
like SunOS 4.x shared libraries, are normally built in
position-independent form and don't always have to be at the same place
in the virtual address space; the changes made to the source of library
routines for SV.3 shared libraries aren't done for SV.4 shared libraries
(you may still want to make some changes for performance reasons).



More information about the Comp.unix.programmer mailing list