HP 3000 Manuals

Relocatable Libraries [ HP Link Editor/XL Reference Manual ] MPE/iX 5.0 Documentation


HP Link Editor/XL Reference Manual

Relocatable Libraries 

A relocatable library contains relocatable object modules and a Library
Symbol Table.  Figure 5-2  illustrates the structure of a relocatable
library.

[]
Figure 5-2. The Structure of a Relocatable Library Relocatable libraries are useful for storing subprograms since subprograms contain common routines that are used frequently. As an example, if several programs use the same routine, you can place it in a relocatable library. Then, to incorporate the routine in each program, name the library when you link the program using LINK. The link editor merges the relocatable object module containing the routine into each program file. Storing routines in relocatable libraries helps eliminate duplication of programming effort and encourages consistency and adherence to local programming standards. Furthermore, since the link editor can search a series of relocatable libraries, you can create different libraries for distinct purposes and then reference only those relocatable libraries that a particular program needs. The library routine becomes part of the program file when the link editor merges the relocatable object module containing the referenced code into the program file. Once the executable program file is created, the program is insulated from changes made to the library routines. To incorporate library changes into a program, you must relink the program using the modified library. When the link editor finds a routine in a relocatable library that resolves an external reference, it merges the entire relocatable object module containing that routine into the calling program. If the module contains code that pertains to a single procedure, the link editor adds that procedure to the program file. If the called procedure is one of several procedures in a module, the entire module is added to the program file.


MPE/iX 5.0 Documentation