next up previous contents
Next: Maintaining large programs (make) Up: . Previous: Broadcasting a message (wall)   Contents

Libraries in UNIX (ar)

Analogous to the library function on the VAX, the command ar is the archive (library) maintainer for UNIX systems. A library is a set of (usually) object files (i.e. compiled but not linked together, names ending in ``.o'') that have been combined into a single archive file. ar is used to create and update library files. The library name ends in ``.a''.

The Suns have implemented shareable libraries, like on the VAX, so that when your program is linked to a library, the actual code of the library routines is not included in the executable (this is known as ``dynamic linking''). When you run the program, the library code will only be loaded into memory if there is not already a copy there, i.e. if no-one else is already using that library. In this way, multiple programs accessing the same library can share the code (but not, of course, the data), which is generally a great savings in time and memory. If for some reason you do not wish to take advantage of this (e.g. you are sending an executable to a system that does not have the library), you can compile/link your program with the -Bstatic option.

truein


next up previous contents
Next: Maintaining large programs (make) Up: . Previous: Broadcasting a message (wall)   Contents
h.stilmack@jach.hawaii.edu