Thomas Haupt
|
Re: Libraries in /usr/qnx/target/qnx6/x86/usr/lib
|
Thomas Haupt
12/04/2009 5:53 PM
post43252
|
Re: Libraries in /usr/qnx/target/qnx6/x86/usr/lib
Hi,
all libraries with a '.a' suffix are /static/ libraries; they are archives (hence the suffix) from which the linker will
take all required parts and, roughly spoken, 'copy' them into the resulting binary. All symbols in the lib are resolved
(i.e., translated into addresses) at link time and you do not need to have the *.a present at run time.
Libraries with a '.so' ('shared object') must be present both at link /and/ at run time. The linker mostly just makes
sure that everything it needs is in the lib, and a bit more - but it does not place the 'actual' code into the binary.
Instead, the library's symbols are resolved when the binary is loaded - for this reason, shared libraries must always be
present in the runtime system. For any number of processes using a .so, the latter is loaded only once (it is shared by
the processes) and merely mapped into the process'es address space. Since the virtual address of a *.so can be
different in each process, the code must not contain any 'absolute' addresses (e.g. for calls, jumps, or references to
static variables). Instead, it must be "position independant", and already the compiler must have generated the code
accordingly.
Now we can see what a *S.a is -- it's a shared (or rather, sharable) static library. As we can tell by it's suffix, .a,
it is a static library and used only at link time -- but it can be used to build shared objects, because it contains
position-independant code.
So in your example:
libEGL.a will be used when statically linking against the EGL lib (-Bstatic)
libEGL.so used when dynamically linking
and when running the resulting executable
libEGLS.a used when building a shared object (so)
and statically linking this against the EGL lib.
Hope this helps...
- Thomas
|
|
|