Converting a Static Library to a Shared Library

Converting a Static Library to a Shared Library

Post by Margaret St. Pier » Wed, 05 Mar 1997 04:00:00



Is it possible to convert a static library (.a) to a shared library
(.so.x)?  If so, how?  (Assume the conversion is done on a
Solaris 2.x machine using GCC or Sparcworks.)

I'd like to reuse my libraries in my Java application, but they
must be in the form of a shared library instead of a static library,
and I don't have access to the original .o files.


 
 
 

Converting a Static Library to a Shared Library

Post by Andrew Giert » Thu, 06 Mar 1997 04:00:00


 Margaret> Is it possible to convert a static library (.a) to a shared
 Margaret> library (.so.x)?  If so, how?  (Assume the conversion is
 Margaret> done on a Solaris 2.x machine using GCC or Sparcworks.)

 Margaret> I'd like to reuse my libraries in my Java application, but
 Margaret> they must be in the form of a shared library instead of a
 Margaret> static library, and I don't have access to the original .o
 Margaret> files.

On most platforms, this is only possible if the original objects were
compiled with -fpic or equivalent option.

--
Andrew.

 
 
 

1. Compiling static libraries as shared libraries

Howdy! I've got myself ~50 megs of sources for about 10 meg of libraries I've
been working with. Right now, they all compile nicely and give me some nice
libwhatever.a files. OK, that's swell, but I can't statically link a good
portion of my programs (Damn ELF won't compile them statically :), so I need to
compile them as libwhatever.so. So, how do I change my source for this. Right
now I'm doing this.

ls -r -o libwhatever.a object1.o object2.o object3.o object4.o

Any help is appreciated.

--
Justin (Gus) Hurwitz

2. permissions on nroff temp file

3. Building shared library which includes static libraries

4. Slackware 3.2.0 & in.telnetd problem

5. Can a static library be compiled into a shared library?

6. login/su not using NIS correctly?

7. Building shared libraries that contain static libraries.

8. kernel 2.0.33 and adaptec 2940au

9. Using static libraries and shared libraries in same program?

10. Using libtool to build shared libraries that depend on static libraries

11. link static libraries into a shared library

12. libtool and shared libraries with static library references

13. how do I find out what shared libraries and static libraries a program depends on?