In what order does the linker process library catalogs?

There may be more than one library instance in the search process during compilation. In what order are the linker process directories included in the search path? This platform belongs to Sun OS.

+5
source share
1 answer

Directories are searched in the order they appear on the command line. The directories specified on the command line are scanned before the default directories. All -L options apply to all -l options, regardless of the order in which the options are displayed. LD_LIBRARY_PATH can also be used to supplement the library search path. Directory search stops in the first directory containing the corresponding library.

LD_LIBRARY_PATH is more complicated:

LD_LIBRARY_PATH 

A list of directories to search for libraries specified in -l. Multiple directories are separated by a colon. In most cases, the general case, it will contain two lists of directories, separated by semicolons:

dirlist1; dirlist2 

If ld is called with any number of occurrences of -L, as in:

ld . . . -Lpath1 . . . -Lpathn . . .

then ordering the search path:

         dirlist1 path1 . . . pathn dirlist2 LIBPATH

When the directory list does not contain a semicolon, this is interpreted as dirlist2.

LD_LIBRARY_PATH . , LD_LIBRARY_PATH , , , .

.

+6

All Articles