1.2.43 $L or $LINK : Link object file

The {$L filename} or {$LINK filename} directive tells the compiler that the file filename should be linked to the program. This cannot be used for libraries, see section 1.2.46, page 129 for that.

The compiler will look for this file in the following locations:

  1. In the path specified in the object file name.
  2. In the directory where the current source file is.
  3. In all directories specified in the object file search path.

Directories can be added to the object file search path with the -Fo command line option.

On linux systems and on operating systems with case-sensitive file systems (such as unix systems), the name is case sensitive, and must be typed exactly as it appears on your system.

RemarkTake care that the object file you’re linking is in a format the linker understands. Which format this is, depends on the platform you’re on. Typing ld or ld --help on the command line gives a list of formats ld knows about.

Other files and options can be passed to the linker using the -k command line option. More than one of these options can be used, and they will be passed to the linker, in the order that they were specified on the command line, just before the names of the object files that must be linked.