Library extension .a/.so
Andrew Hammond
ahammond-swQf4SbcV9C7WVzo/KQ3Mw at public.gmane.org
Tue Apr 26 14:45:58 UTC 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Byron L. Sonne wrote:
>> What is the difference in libraries ending with extension .a and .so.
>> Can one convert from somelib.a to somelib.so?
>
> I'd like to know as well - I've tended to think that it's the difference
> between static and dynamic, but upon reflection I don't have a good
> reason for thinking that. Or if I did, I've forgotten it.
You are correct. Archive libraries end with the .a and can be created
and analyzed using ar ranlib and nm (the man pages for each are pretty
helpful). They are linked statically on compile to the binary you're
building. Statically linked libraries are great for debugging and, in a
few very special circumstances can yeild a performance boost.
Dynamically linked libraries are the libsomething.so.<versioning> that
you often see under /lib and /usr/lib with a whole bunch of symlinks
pointing to them. They're loaded dynamically, usually when a program
starts. There are a number of big wins that come from dynamically linked
libraries. The obvious ones are that you only need to have a single
image of the library binary in memory and that you can upgrade libraries
without re-compiling applications.
Creating solibs is done by gcc (unless you want to call the linker
directly, which is probably not a good idea)
gcc -shared -Wl,-soname,your_soname -o library_name file_list library_list
You could put a .a library in the library list to convert it to a solib
if you were so inclined. I don't know how to go in the other direction.
There's a good FAQ on this subject, which covers a lot of stuff I've
glossed over, at
http://www.faqs.org/docs/Linux-HOWTO/Program-Library-HOWTO.html
- --
Andrew Hammond 416-673-4138 ahammond-swQf4SbcV9C7WVzo/KQ3Mw at public.gmane.org
Database Administrator, Afilias Canada Corp.
CB83 2838 4B67 D40F D086 3568 81FC E7E5 27AF 4A9A
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCblQlgfzn5SevSpoRAqbqAJ48P53HWwz+5cBsojuDGXtEASYugQCfeq2x
NBdTa5sBphf4vTj8V8tFMDg=
=RWfr
-----END PGP SIGNATURE-----
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list