You copied the Doc URL to your clipboard.

Using shared libraries in your application

You use shared libraries with armlink in the same way as normal libraries by specifying them on the linker command line. References to the shared library are added to the image and resolved to the library by the dynamic loader at runtime.

References to libraries are resolved in the order they are specified on the command line. This is also the order that the dependencies are resolved by the dynamic linker. You can specify the runtime location of libraries using the --rpath GNU ld option, that is an accepted alias of the --runpath linker option.

Unlike GNU ld, armlink repeatedly searches libraries in command-line order until either all references are resolved or no further references can be resolved by the given libraries. That is, armlink behaves similarly to:

ld --start-group lib1.a lib2.a lib3.a … --end-group

armlink supports a --library=name option similar to the -l option in GNU ld. This can search for libraries named as libname.so or libname.a depending on whether dynamic library searching is enabled at that point on the command line. The searching of dynamic libraries is controlled by the --[no_]search_dynamic_libraries option, as shown in the last two lines of the following example:

gcc -shared -fPIC -Wl,-Bdynamic -lfoo -Wl,-Bstatic -lbar
armcc --arm_linux -L--shared -L--fpic \-L--search_dynamic_libraries -L--library=foo \-L--no_search_dynamic_libraries -L--library=bar

These two command lines perform a link searching for libfoo.so before libfoo.a, but only searching for libbar.a.

Was this page helpful? Yes No