Red Hat Linux GNU Link Question [Archive] - C Board

PDA

View Full Version : Red Hat Linux GNU Link Question


PieartL
02-27-2002, 01:56 PM
Hi,
I need to determine if what I am trying to do is even possible. I am not a c programmer by any stretch of the imagination. However, I have inherited this project because nobody else knows c here either (short straw). Hopefully one of you c gurus can help me stop beating my head against the wall...

Our environment is Red Hat Linux 6.2 and Oracle. In the past, I have been able to create a c interface routine to CyberSource's credit card clearing SDK. To function in their environment, Oracle requires that it be a .so shared object. CyberSource provided both a .so and .a version of their routines as well as some good examples of how to do the compile and link. Using the .a version, I was able to create a usable .so using:

gcc -c -O pcdcrcard.c
ld -G -o pcdcrcard.so pcdcrcard.o libics2.a -lc

The libics2.a library is just under 800KB. My resulting .so is fairly close in size to that.

Now I am trying to create a similar interface for the TeleCheck electronic check processing SDK. Unfortunately they only provide a .so file and absolutely no examples or documentation.

When I try something similar to the CyberSource example:

gcc -c -O pcdtelecheck.c
ld -G -o pcdtelecheck.so pcdtelecheck.o libpfpro.so -lc

I get a .so out, but it is only the same size as a statically linked executable. The libpfpro.so is almost 700KB. My new .so is only 28K. That leads me to believe that I don't have a true .so file.

So, my question is: Is it possible to link an existing .so with a new c program, producing a new usable .so that contains everything from the original .so?

Any help would be greatly appreciated.
Thanks,

alex
02-28-2002, 11:33 AM
If libpfpro.so is installed correctly on the system where you are using your own shared object (pcdtelecheck.so), then it should all work fine:
As soon as pcdtelecheck.so calls any of the functions from libpfpro.so, it should automatically bind this SO, if the libpfpro.so is in /lib, or any of the directories specified in /etc/ld.so.conf. If you need (or want) to install it somewhere else, you can set the environment variable LD_LIBRARY_PATH to include the directory you need before running the program that needs your SO, or you can add the option -rpath,/my/own/directory to the command line of ld.

alex

P.S. you can check whether pcdtelecheck.so reference libpfpro.so correctly using "ldd pcdtelecheck.so"

PieartL
02-28-2002, 12:05 PM
Alex,
I'll give that a try.
Thanks a million!
Larry