| |||
| Home > Image structure and generation > Specifying user libraries when linking | |||
To specify user libraries:
include them with path information explicitly in the input file list
add the --userlibpath option to
the armlink command line with a comma-separated
list of directories, and then specify the names of the libraries
as input files.
You can use the --library= option
to specify static libraries, namelib,
or dynamic shared objects, name.alib.
Dynamic searching is controlled by the name.so--search_dynamic_libraries option. For
example, the following command searches for libfoo.so before libfoo.a:
armlink --arm_linux --shared --fpic --search_dynamic_libraries --library=foo
If you do not specify a full path name to a library on the
command line, the linker tries to locate the library in the directories
specified by the --userlibpath option. For example,
if the directory /mylib contains my_lib.a and other_lib.a,
add /mylib/my_lib.a to the input file list
with the command:
armlink --userlibpath /mylib my_lib.a *.o
If you add a particular member from a library this does not
add the library to the list of searchable libraries used by the
linker. To load a specific member and add the
library to the list of searchable libraries include the library on
its own as well as specifying filename.
For example, to load library(member)strcmp.o and place mystring.lib on
the searchable library list add the following to the input file
list:
mystring.lib(strcmp.o) mystring.lib
Any search paths used for the ARM standard libraries specified
by either the linker command-line option --libpath or
the ARMLIB or ARMCC environment
variables are not searched for user libraries.nLIB
Linker Reference:
ARM® C and C++ Libraries and Floating-Point Support Reference:
Introducing the ARM Compiler toolchain: