Library extension .a/.so

Peter plp-ysDPMY98cNQDDBjDh4tngg at public.gmane.org
Wed Apr 27 05:55:25 UTC 2005



On Tue, 26 Apr 2005 billt-lxSQFCZeNF4 at public.gmane.org wrote:

> On Wed, Apr 27, 2005 at 01:35:49AM +0300, Peter wrote:
>>
>>>>>> What is the difference in libraries ending with extension .a and .so.
>>>>>> Can one convert  from somelib.a to somelib.so?
>>
>> To convert .a to .so one must extract the contents of the .a archive
>> using ar and then relink these files into a .so object. Usually it is
>> necessary to also link the .so object against one of the ld.so stubs
>> (usually /lib/ld-linux.so.2) to make it work. This usually works
>> smoothly and solves the problem (static linking) mentioned by Lennart.
>> The exact options to be used vary but the .so name must be linked with
>> general options like:
>>
> The important caveat to remember is this works on linux using the gcc 
> compiler because gcc creates relocatable code. Other UNIX or other 
> compiles may not work.

But it covers all platforms that use gcc. NetBSD, OpendBSD, FreeBSD, 
...

Peter
--
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