Building shared library which includes static libraries

Building shared library which includes static libraries

Post by Sanjay K. Agrawa » Sat, 18 Nov 1995 04:00:00



SPARC Solaris 2.4 using 4.0.1 SPARC C++ compiler.

My application comprises of an executable and a number of shared libraries.
One of the shared libraries is an interface to Oracle using OCI calls. This
shared (database) library was built as follows:

    ld -G -dy -B symbolic -o my_shared_lib.so mod1.o mod2.o ... Oracle static
        libraries ... more libraries..

mod1.o, mod2.o ... were compiled with the -PIC option.

Now, when I run my application, I crash, with a bad opcode, whenever any
Oracle function is accessed from the mod1.o mod2.o ... modules. If I link the
Oracle static libraries with the executable, then everything is fine. However,
that is not what I want.

How can I get the above to work, or is it not possible? Any comments/advice
will be greatfully appreciated.

Thanks in advance,

Sanjay Agrawal
--

555 Twin Dolphin Drive #400      Voice: (415)594-8754
Redwood City, CA 94065           Fax:   (415)594-8645

 
 
 

1. Building shared libraries that contain static libraries.

I am trying to build a shared library in C++ which incorporates a
third party library which is only available for static linking. I am
experiencing the same problem on both Solaris 2.7 and Linux (RH 7.0),
although a windows version works fine.

I am getting an unresolved symbol error when I try and load the shared
library and the symbol it is looking for is in the static library that
was linked with my code. I believe this is related to the way the
WSpro 5 compiler and gcc 2.96 compiler work with static libraries
linked in dynamic libraries. I have been told that the compiler does
not actually link the static elements in but expects any client apps
to link in the static libraries as well. My problem here is that the
client is a java app using JNI so I cannot link in the static
libraries.

Is my understanding correct and is there any way to force either
compiler to include the static components ? I have approached the 3rd
party vendor and they are quoting in excess of 6 months to get a
dynamic version of their library available, I have to complete this by
Christmas so this is not an option.

Thanks

Simon

2. 2port KVM Switch Keyboard/Video/Mouse PS2 In USB Out

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

4. New group for Win bashing...

5. Help with building shared libraries with dependencies on other shared libraries

6. Libg++ with pentium gcc on 2.2.1R ???

7. Compiling static libraries as shared libraries

8. fvwm-0.91 upload is corrupt

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

10. Converting a Static Library to a Shared Library

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

12. link static libraries into a shared library

13. libtool and shared libraries with static library references