Fortran User's Guide

-Ldir

Add dir to list of directories to search for libraries.

    SPARC: x86:77

Add dir at the start of the list of object-library search directories. A space between -L and dir is optional. This option is passed to the linker. See also -lx on "-lx".

While building the executable file,ld(1) searches dir for archive libraries (.a files) and shared libraries (.so files). ld searches dir before searching the default directories. (See the Fortran Programming Guide chapter Libraries for information on library search order.) For the relative order between LD_LIBRARY_PATH and -Ldir, see ld(1).

Example: Use -Ldir to specify library search directories:


demo% f77 -Ldir1 -Ldir2 any.f


Note -

Specifying /usr/lib or /usr/ccs/lib with -Ldir may prevent linking the unbundled libm. These directories are searched by default.