June 2017
Intermediate to advanced
478 pages
13h 14m
English
A more common way to deploy libraries is as shared objects that are linked at runtime, which makes more efficient use of storage and system memory, since only one copy of the code needs to be loaded. It also makes it easy to update the library files without having to re-link all the programs that use them.
The object code for a shared library must be position-independent, so that the runtime linker is free to locate it in memory at the next free address. To do this, add the -fPIC parameter to gcc, and then link it using the -shared option:
$ arm-cortex_a8-linux-gnueabihf-gcc -fPIC -c test1.c$ arm-cortex_a8-linux-gnueabihf-gcc -fPIC -c test2.c$ arm-cortex_a8-linux-gnueabihf-gcc -shared -o libtest.so test1.o test2.o
This ...
Read now
Unlock full access