Sun Studio 12: Fortran Programming Guide

4.3.3.2 Command-Line Order for -Ldir Options

The -Ldir option adds the dir directory path to the library search list. The linker searches for libraries first in any directories specified by the -L options and then in the standard directories. This option is useful only if it is placed preceding the–llibrary options to which it applies.