views:

626

answers:

1

I have a shared library say "libeval.so". I am using this in my project to create on more shared library called say "lidpi.so". The library called "libdpi.so" is used by a tool. Now, this tool cannot see any other library other than "libdpi.so". I am using few function calls that are present in "libeval.so", and these are not present in "libdpi.so". Is there any switch in gcc, or something to overcome this.

+2  A: 

If libdpi.so is designed so that it can open libeval.so, then your program only needs to know about libdpi.so.

Specifically, libdpi.so should have some function that calls dlopen, probably like this:

dlopen("path/to/libdpi.so", RTLD_LAZY);

Then other functions in libdpi.so can interface with libeval.so.

Edit: To build a shared library, use this command:

gcc -shared -o libdpi.so [list of object files to go in libdpi.so]

Note: When you build your objects, use the -fPIC command argument with gcc, like this:

gcc -fPIC -o foo.o foo.c
Scottie T
I am not sure how libdpi.so is created :(
Alphaneo
Hi somehow, the following option's seems to be working :)gcc -fPIC $(ALL_OBJ) $(ALL_PATH) -leval -shared -o libdpi.soI will try to find an explanation :)I also made some research on your suggestion. It is probably a nice method to load the library, I guess.
Alphaneo