home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / NeXT / Misc / HigherEducationMailbox.mbox / Archives_provide_val_.attach / May_91 / os.402 < prev    next >
Text File  |  1991-05-21  |  3KB  |  43 lines

  1. {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
  2. \paperw9840
  3. \paperh6720
  4. \margl120
  5. \margr120
  6. {\f0\fs24\fi0\li0\ql\gray0 Q:  What's a shlib, and how does it affect me?\
  7. \
  8. 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.\
  9. \
  10. 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.\
  11. \
  12. 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 }
  13. {\f0\b\fs24\fi0\li0\ql\gray0 /usr/lib/libNeXT_s.a}
  14. {\f0\fs24\fi0\li0\ql\gray0 .  (Note that there shoud also be a regular archive library that has all the profiling information in it -- }
  15. {\f0\b\fs24\fi0\li0\ql\gray0 /usr/lib/libNeXT_p.a}
  16. {\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 }
  17. {\f0\b\fs24\fi0\li0\ql\gray0 /usr/shlib/libNeXT_s.C.shlib}
  18. {\f0\fs24\fi0\li0\ql\gray0 .  In this particular case,  }
  19. {\f0\b\fs24\fi0\li0\ql\gray0 C }
  20. {\f0\fs24\fi0\li0\ql\gray0 is the version letter.\
  21. \
  22. When compiled with }
  23. {\f0\b\fs24\fi0\li0\ql\gray0 -lNeXT_s}
  24. {\f0\fs24\fi0\li0\ql\gray0 , an a.out will contain the name of the file that it needs to use at runtime.  The }
  25. {\f0\b\fs24\fi0\li0\ql\gray0 otool}
  26. {\f0\fs24\fi0\li0\ql\gray0  program, with the }
  27. {\f0\b\fs24\fi0\li0\ql\gray0 -L}
  28. {\f0\fs24\fi0\li0\ql\gray0  option, will show which runtime libraries it expects.  (See the }
  29. {\f0\b\fs24\fi0\li0\ql\gray0 otool}
  30. {\f0\fs24\fi0\li0\ql\gray0  man page.)\
  31. \
  32. The first application that touches the shared library pulls it into memory.  All others after that will point to that copy in memory.\
  33. \
  34. 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).\
  35. \
  36. QA402\
  37. \
  38. Valid for 1.0 \
  39. Not checked yet for 2.0\
  40. \
  41.  
  42.  
  43.