Library Naming Conventions
By convention, library names have the form:
libname. suffix
name | is a string of one or more characters that identifies the library. |
suffix | is .a if the library is an archive library, .sl if the library is a |
| or .so if the library is a shared library. (The suffix can be .sl for an IPF shared library. |
| This naming convention is not recommended, but it is supported for backwards |
| compatibility with |
Typically, library names are referred to without the suffix. For instance, the standard C library is referred to as libc.
Default Libraries
A compiler driver automatically specifies certain default libraries when it invokes ld. For example, cc automatically links in the standard library libc, as shown by the
$ cc
...
/usr/ccs/bin/ld
Similarly, the Series 700/800 Fortran90 compiler automatically links with the libcl (C interface), libisamstub (ISAM file I/O), and libc libraries:
$ f90
...
/usr/ccs/bin/ld
The Default Library Search Path
Following are the default search paths for the libraries:
•On Itanium systems, ld searches for libraries in the directory /usr/lib/hpux32 for
•On
If the
/usr/lib/libp (for PA32) /usr/lib/pa20__64/libp (for PA64) /usr/lib/hpux32/libp (for IPF
The default order can be overridden with the LPATH environment variable, the
Link Order
The linker searches libraries in the order in which they are specified on the command line - the link order. Link order is important in that a library containing an external reference to another library must precede the library containing the definition. This is why libc is typically the last
24 Compiling and Linking Programs on