using a static library in a shared library?

Lindsay, Steve steve.lindsay@misys.com
Mon Jul 15 03:08:00 GMT 2002


Is it possible to build a shared library that contains a static library?
In other words, I want to create something called libmyshared.so which
uses functions in something called libcus.a.

I'm using gcc 2.95.3 on Solaris 8.

When I type:

gcc -shared -o libmyshared.so mytest.o
/export/home/CASmf/SunOS/obj/libcus.a

I get a huge long list like this:

Text relocation remains                         referenced
    against symbol                  offset      in file
<unknown>                           0x19f0
/export/home/CASmf/SunOS/obj/libcus.a(cusapi2.o)
<unknown>                           0x19f4
/export/home/CASmf/SunOS/obj/libcus.a(cusapi2.o)
<unknown>                           0x19f8
/export/home/CASmf/SunOS/obj/libcus.a(cusapi2.o)
<unknown>                           0x19fc
/export/home/CASmf/SunOS/obj/libcus.a(cusapi2.o)
<unknown>                           0x244c
/export/home/CASmf/SunOS/obj/libcus.a(cusapiint.o)
<unknown>                           0x2450
/export/home/CASmf/SunOS/obj/libcus.a(cusapiint.o)

ending with:

ld: fatal: relocations remain against allocatable but non-writable
sections
collect2: ld returned 1 exit status

I've looked through the GCC documentation and haven't found an answer to
this question.  Could someone point me in the right direction, or tell
me if what I'm trying to do is possible?

Thanks,
Steve Lindsay



More information about the Gcc-help mailing list