|
Libraries |
Top Previous Next |
|
It is often convenient to be able to treat a group of object files as a single unit. For example, the Diamond run-time library comprises many separate object files, but is supplied as a single file containing all of them. As we have seen above, the linker searches libraries for the necessary modules to complete the program being linked.
Using a library has several advantages over using a linker command file:
Library files are created and maintained by the archiver. Details of this program may be found in the TI documentation.
The example below shows a hypothetical graphics library, grafpak.lib, being built from a core graphics module, core.obj, and two device driver modules, tek.obj and hp.obj:
» ar6x -a grafpak.lib core.obj tek.obj hp.obj
The default extension for the library name is .lib. The archiver does not assume an extension for the object file names; you must specify .obj explicitly for each one.
The following example shows how to replace an existing module hp.obj with a different version:
» ar6x -r grafpak hp.obj
It is probably safer always to use the –r option with the archiver to ensure that only the more recent versions of files are kept.
|