Libraries in Unix are the same as libraries in other operating systems. They
usually contain a collection of pre-compiled routines which you can link to
your routines when creating an executable. On all Unix systems,
libraries can be created with
the command ar (short for archive). See section
.
Once again, it is not necessary for a new Unix user to know this command but you can find more information in the man pages.
Libraries in Unix follow a naming convention such that names begin with the letters lib and have the extension .a ( for archive ) or .sl ( for shared library ). This was not a whim of the creators of Unix but actually serves a useful purpose.
When specifying libraries to be used in linking you can use a shorthand notation. If you wish, you can specify the full pathname of the library just as you would with your object files .o files. For example;-
f77 mprog.f mysub.o /cern/pro/lib/libpacklib.a
Or you can
specify the library with a combination of the -L and -l options,
e.g. -L/cern/pro/lib -lpacklib which refers to the CERNLIB library
packlib. What this actually is instructing the link editor to do is to search
the directory ( search path) /cern/pro/lib for the library
libpacklib.a which will then be replaced on the command line with
/cern/pro/lib/libpacklib.a which you could type in yourself.
fort77 +ppu -O -o my_program my_program.f
-L/usr/local/delphi/dpadev/lib -ltanag3xx
-L/cern/pro/lib -lgraflib -lgrafX11 -lpacklib
NOTE that the placement of a library on the command line is important (as it also is for the VAX/VMS LINK command); the libraries are searched once only, in the order they appear on the command line.