Red Hat Linux GNU Link Question

This is a discussion on Red Hat Linux GNU Link Question within the Linux Programming forums, part of the Platform Specific Boards category; Hi, I need to determine if what I am trying to do is even possible. I am not a c ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    2

    Red Hat Linux GNU Link Question

    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,

  2. #2
    Registered User alex's Avatar
    Join Date
    Sep 2001
    Posts
    132
    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"

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    2
    Alex,
    I'll give that a try.
    Thanks a million!
    Larry

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. dual boot windows xp home and red hat 9
    By Boomba in forum Tech Board
    Replies: 0
    Last Post: 01-09-2004, 03:09 PM
  2. Red Hat linux 9 Installation CD images
    By nonUser in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 05-29-2003, 07:33 AM
  3. link list question
    By alokin in forum C Programming
    Replies: 3
    Last Post: 10-30-2002, 10:25 PM
  4. Linux and serial cable question
    By Hannwaas in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 04-18-2002, 08:04 PM
  5. Question about LINUX
    By River21 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 09-17-2001, 07:39 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21