-L

Category

Linking

Pragma equivalent

None.

Purpose

At link time, searches the directory path for library files specified by the -l option.

Syntax

Read syntax diagramSkip visual syntax diagram
>>- -L--directory_path-----------------------------------------><

Defaults

The default is to search only the standard directories. See the compiler configuration file for the directories that are set by default.

Parameters

directory_path
The path for the directory which should be searched for library files.

Usage

Paths specified with the -L compiler option are only searched at link time. To specify paths that should be searched at run time, use the -R option.

If the -Ldirectory option is specified both in the configuration file and on the command line, search paths specified in the configuration file are the first to be searched at link time.

The -L compiler option is cumulative. Subsequent occurrences of -L on the command line do not replace, but add to, any directory paths specified by earlier occurrences of -L.

For more information, refer to the ld documentation for your operating system.

Predefined macros

None.

Examples

To compile myprogram.c so that the directory /usr/tmp/old is searched for the library libspfiles.a, enter:
xlc myprogram.c -lspfiles -L/usr/tmp/old

Related information



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us