Technical data

Compiling and Linking
7
See the section called FILES in the f77(1) manual page for a complete list
of the les used by the Fortran driver. Also refer to the ld(1) manual page for
information on specifying the l option.
Specifying Link Libraries
You must explicitly load any required run-time libraries when compiling
multilanguage programs. For example, when you link a program written in
Fortran and some procedures written in Pascal, you must explicitly load the
Pascal library libp.a and the math library libm.a with the options lp and lm
(abbreviations for the libraries libp.a and libm.a). This procedure is
demonstrated in the next example.
% f77 main.o more.o rest.o -lp -lm
To nd the Pascal library, the link editor replaces the l with lib and adds an
.a after p. Then, it searches the /lib, /usr/lib, and /usr/local/lib directories for
this library. For a list of the libraries that a language uses, see the associated
driver manual page, cc(1), f77(1), or pc(1).
You may need to specify libraries when you use IRIX system packages that
are not part of a particular language. Most of the manual pages for these
packages list the required libraries. For example, the getwd(3B) subroutine
requires the BSD compatibility library libbsd.a. This library is specied as
follows:
% f77 main.o more.o rest.o -lbsd
To specify a library created with the archiver, type in the pathname of the
library as shown below.
% f77 main.o more.o rest.o libfft.a
Note: The link editor searches libraries in the order you specify. Therefore,
if you have a library (for example, libfft.a) that uses data or procedures from
lp, you must specify libfft.a rst.