9.2.21 --library libname
(-l libname)
Search for library libname
.
Add archive file libname
to the list of
files to link. This option may be used any number of times. xc-dsc-ld
will search its path-list for occurrences
of lib
libname
.a
for every libname
specified. The linker will search an archive only once, at the location where it is
specified on the command line. If the archive defines a symbol that was undefined in some
object that appeared before the archive on the command line, the linker will include the
appropriate file(s) from the archive. However, an undefined symbol in an object appearing
later on the command line will not cause the linker to search the archive again. See the
-(
option for a way to force the linker to search
archives multiple times. You may list the same archive multiple times on the command
line.
If the format of the archive file is not recognized, the linker will ignore it. Therefore, a version mismatch between libraries and the linker may result in “undefined symbol” errors.
If file lib
libname
.a
is not found, the linker will search for an ELF-specific version of the
library with name lib
libname
-elf.a
.