-L/opt/fortran90/lib/pa20_64/ -lF90 -lisamstub

NOTE: For more information on Itanium library paths corresponding to the above examples, see Table 23 (page 51).

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, non default 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[3264]/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” (page 131).

/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” (page 105). (PA-RISC only)

Both the libU77and BLASlibraries are described in the HP Fortran Programmer’s Reference.

Linking to shared libraries

Many HP Fortran libraries as well as HP-UX libraries exist in both shared and archive versions, as indicated by the library extension name (.sl or.aor .slon Itanium). For example, there are both shared and archive versions of the HP Fortran runtime library, /usr/lib/libcl.sl and /usr/lib/libcl.a.

The difference between a shared library and an archive library is that the linker does not actually link the code in a shared library with your program. Instead, any references that your program makes to entities in the shared library are resolved at load-time, when the library is loaded into the executable program’s address space. By contrast, code in the archive library is copied to the executable program file.

The advantages of linking shared libraries are:

The executable is smaller than it would be if linked with an archive file because the executable file is incomplete—it doesn’t include code from the library.

Using shared libraries ensures that you always get the most recent version of the library. If you link with an archive version, you get the version that was available at link-time. If, later on, you want a more recent version of the library, you must re-link your program with that library.

The disadvantage of linking with a shared library is that it creates a dependency between the library and the program; both the shared library and the program must always be installed together on the same system. By contrast, linking with an archive library makes the executable program independent of the library to which it was linked. Also, programs that make frequent calls to library routines may run more slowly when linked to shared libraries.

By default, the linker selects the shared version of a library, if one is available; otherwise, it selects the archive version.

Linking HP Fortran programs 53

Page 53
Image 53
HP UX Fortran Software manual Additional HP Fortran libraries, Linking to shared libraries