$LINKLIB : Link to a library

The {$LINKLIB name} will link to a library name. This has the effect of passing -lname to the linker.

As an example, consider the following unit:

 unit getlen;
 
 interface
 {$LINKLIB c}
 
 function strlen (P : pchar) : longint;cdecl;
 
 implementation
 
 function strlen (P : pchar) : longint;cdecl;external;
 
 end.
If one would issue the command
 ppc386 foo.pp
where foo.pp has the above unit in its uses clause, then the compiler would link the program to the c library, by passing the linker the -lc option.

The same effect could be obtained by removing the linklib directive in the above unit, and specify -k-lc on the command-line:

 ppc386 -k-lc foo.pp