NOTE: For libF90, libU77, and libIO77(Itanium® only), archive libraries are selected by default (see +sharedlibF90, +sharedlibU77, and +sharedlibIO77options).
To force the linker to select archive libraries, specify the
f90command line. f90passes the arguments to the
$ f90
For information about the linker’s
Library search rules
When you use the
Alternatively, you can use the
$ f90
causes the linker to search for libraries (including libstuff.sl and libstuff.a), starting with the directory /my_libsand then looking in /opt/fortran90/lib and /usr/lib.
Special-purpose compilations
The default behavior of the HP Fortran compiler has been designed to handle typical compilations. Most applications should require no more than a few of the f90options to compile successfully (see Table on page 25 for a list of commonly used options).
However, the compiler can also meet the needs of more specialized compilations. This section explains how to use the f90command for the following purposes:
•To compile programs that contain Fortran modules.
•To compile programs that will execute on different
•To create object files for shared libraries.
•To process source files that contain C preprocessor directives.
•To create
•To create shareable executable programs.
•To compile
Compiling programs with modules
One of the features of standard Fortran is the module, a program unit that facilitates shared access to data and procedures. Modules are fully described in the HP Fortran Programmer’s Reference.
A benefit to using modules is that they provide interface information to the compiler, allowing it to catch mismatch errors between (for example) dummy arguments and actual arguments. When the HP Fortran compiler processes a file that defines a module, it generates a .modfile with the interface information. Later, when the compiler processes a file that uses the module, it reads the .modfile and checks that module entities that are referenced in the using file correctly match the information in the.mod file.
54 Compiling and linking