You copied the Doc URL to your clipboard.

--library=name

This option enables the linker to search either a dynamic library, libname.so, or a static library, libname.a, depending on whether dynamic library searching is enabled at that point on the command line:

  • if dynamic linking is enabled, the linker dynamically links with the library, libname.so

  • if dynamic linking is disabled it links with the static library, libname.a.

Dynamic linking is enabled by default. Use the --[no_]search_dynamic_libraries option to control the searching of dynamic or static libraries.

Usage

The --library option enables you to link against a library without specifying the full library filename on the command-line.

If you specify the --[no_]search_dynamic_libraries option, it applies to the following --library options up until the next --[no_]search_dynamic_libraries option.

References to the shared library are added to the image and resolved to the library by the dynamic loader at runtime. The order in which references are resolved to libraries is the order in which libraries are specified on the command line. This is also the order in which the dependencies are resolved by the dynamic linker. You can specify the runtime location of libraries using the --runpath option.

Example

The following example shows how to search for libfoo.so before libfoo.a, but only search for libbar.a:

--arm_linux --shared --fpic --search_dynamic_libraries --library=foo --no_search_dynamic_libraries --library=bar
Was this page helpful? Yes No