# Libraries

• -Wl,-llibrary

Search the library named library when linking.

It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus, foo.o -lz bar.o searches library z after file foo.o but before bar.o.

The linker searches a standard list of directories for the library, which is actually a file named liblibrary.a. The linker then uses this file as if it had been specified precisely by name.

• -Wl, Ldir

Add directory dir to the list of directories to be searched for -l.