{\f0\fs24\fi0\li0\ql\gray0 Q: What's a shlib, and how does it affect me?\
\
A: A shlib is a shared library. It is a library that contains object code that several executable files may use simultaneously. When a program is linked or compiled with a shared library, the library code that defines the external references are not copied into the object file. Instead it binds the address to a branch table which points to the actual code.\
\
Shared libraries help save disk storage because the a.out files don't contain copies of the archive. It also saves memory at runtime because the a.out files point to one copy of the code. It helps to keep all applications up to date, because when a shared library is replaced, all applications will use the new version without needing to be recompiled. Unfortunately, it is harder to maintain a shared library because there are more things that need to remain constant in order for new versions to be compatible.\
\
There are two parts in a shared library, the host library and the runtime library. The host library gets linked in at compile time. It's something like }
{\f0\fs24\fi0\li0\ql\gray0 .) The runtime or target library contains the branch table and the actual code. It must be installed on the machine in order for the application to execute. It's something like }
{\f0\fs24\fi0\li0\ql\gray0 . In this particular case, }
{\f0\b\fs24\fi0\li0\ql\gray0 C }
{\f0\fs24\fi0\li0\ql\gray0 is the version letter.\
\
When compiled with }
{\f0\b\fs24\fi0\li0\ql\gray0 -lNeXT_s}
{\f0\fs24\fi0\li0\ql\gray0 , an a.out will contain the name of the file that it needs to use at runtime. The }
{\f0\b\fs24\fi0\li0\ql\gray0 otool}
{\f0\fs24\fi0\li0\ql\gray0 program, with the }
{\f0\b\fs24\fi0\li0\ql\gray0 -L}
{\f0\fs24\fi0\li0\ql\gray0 option, will show which runtime libraries it expects. (See the }
{\f0\b\fs24\fi0\li0\ql\gray0 otool}
{\f0\fs24\fi0\li0\ql\gray0 man page.)\
\
The first application that touches the shared library pulls it into memory. All others after that will point to that copy in memory.\
\
For related information, read the section "Using Shared Libraries" in the "Tools" chapter of the 1.0 Technical Documentation (page 33 of /NextLibrary/Documentation/NeXT/SysRefMan/18_Tools.wn).\