1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

need help with shared libraries using g++ and C++

Discussion in 'Unix' started by rpcraig, Oct 19, 2008.

  1. rpcraig

    rpcraig New Member

    Joined:
    Oct 19, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    I have an existing library called libt1.so which has a class definition in it I will be using. I would like to create a new shared library out of an object file called AddNumbers.o that creates an instance of a class in libt1.so. So essentially my question is: How do I create a new shared library called libnew.so that is made up of AddNumbers.o and libt1.so.
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    I don't know if that's possible. You can merge static libraries together with ar, but a shared object is linked together, not ar'd together. If there's a static version of libt1.so, i.e. libt1.a, then you can do it with ar.
     
  3. rpcraig

    rpcraig New Member

    Joined:
    Oct 19, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    so if i had libt1.a I could create a shared library out of that by:
    g++ -shared -o libout.so ./lint1.a
    so I can create shared libraries out of archives and objects, or objects, or archives, but not shared and objects?
     

Share This Page