HP Fortran Programmer Guide HP-UX 11i v1, HP-UX 11i v2, and HP-UX 11i v3 (B3908-90032,December 2012)
This form of the command line is useful for linking libraries that do not conform to the naming
convention required by the-l option or that reside in a directory other than /lib or /usr/lib.
As with the -l option, the library name must follow the name of the source file that references it.
For example, the following command line links prog.f90with the my_routineslibrary , both
of which reside in the current working directory:
$ f90 prog.f90 my_routines
If your program calls routines in a library but the linker is unable to resolve the references, compile
with the -Wl,-voption. The f90command passes -vto the linker, causing it to process in verbose
mode. The verbose information includes:
• The names of the libraries that the linker is searching. This information can confirm that the
linker is searching the correct libraries.
• The names of the object files selected by the linker to resolve the references. The linker may
have found the same name in another library and resolved the reference there.
Many library-related problems are owing to a misplaced-l on the command line. The -Loption
(discussed in “Library search rules” on page 84) is also order-sensitive and can cause similar
problems.
Linking HP Fortran 90 routines
When calling HP Fortran 90 routines on the HP 9000 Series 800, you must include the appropriate
run-time libraries by adding certain arguments to the aCC command when linking your program.
These arguments depend on how the Fortran 90 routines were compiled:
32-bit PA-RISC 1.1 code
-L/opt/fortran90/lib/ -lF90 -lisamstub
32-bit PA-RISC 2.0 code
-L/opt/fortran90/lib/pa2.0/ -lF90 -lisamstub
64-bit PA-RISC 2.0 code
-L/opt/fortran90/lib/pa20_64/ -lF90 -lisamstub
NOTE: For more information on Itanium library paths corresponding to the above examples, see
“Libraries linked by default on Itanium” on page 80 .
When the linker finds a reference in your program to a name that is not defined in the program
(for example, the DOT_PRODUCTintrinsic), it looks to resolve it in the default libraries. If it cannot
find the name in the default libraries, the link will fail unless the command line specifies additional,
nondefault libraries. This section discusses how to link to nondefault libraries (including shared
libraries) and library search rules.
Additional HP Fortran libraries
HP Fortran provides the following two libraries you can link with Fortran programs:
• /opt/fortran90/lib/libU77.aon PA-RISC or /usr/lib/hpux[32|64]/libU77.aOn
Itanium: The BSD 3f (libU77)library, which provides a Fortran interface to some of the
libcsystem routines. Programs that reference routines in this library must be compiled with
the +U77option. For information about porting Fortran programs that reference libU77routines,
see “Migrating to HP Fortran” on page 219.
• /opt/fortran90/lib/libblas.a: The Basic Linear Algebra Subroutine (BLAS) library,
which provides routines that perform common vector and matrix operations. Programs that
reference routines in this library must be compiled with the +lblasoption. For more information,
see “Calling BLAS library routines” on page 169. (PA-RISC only)
Both the libU77and BLASlibraries are described in the HP Fortran Programmer’s Reference.
Linking HP Fortran programs 51