Linking libraries with local symbols

Discussion in 'C++' started by Bernd Geiser, Aug 18, 2003.

  1. Bernd Geiser

    Bernd Geiser Guest

    Recently I tried the following:

    I created two libraries lib1.a and lib2.a. Both contain the object a.o which
    instantiates a class from b1.o (or b2.o respectively), where b1.o and b2.o
    have the same interface (header) and thus the symbol names are identical.
    In order to be able to link lib1.a and lib2.a with main.cpp I tried to
    localize the duplicated symbols (with GNU objcopy) and partially linked a.o
    with b1.o and a.o with b2.o. This didn't work though.... somehow linking
    both libs with the main-file eliminated b2.o's symbols.
    So I tried to strip the localized symbols from the partially linked objects
    before packing them into the lib but this didn't work, too... for some
    reason objcopy complains that they are still required. What is going wrong?
    Localizing the symbols and resolving them by partial linkage should make a
    strip possible, or am I missing sth.?
    I hope I made myself clear enough. Any ideas how to get this working? b1.o
    and b2.o definitely need the same interface.

    Thanks,
    Bernd
     
    Bernd Geiser, Aug 18, 2003
    #1
    1. Advertising

  2. Bernd Geiser

    Artie Gold Guest

    Bernd Geiser wrote:
    > Recently I tried the following:
    >
    > I created two libraries lib1.a and lib2.a. Both contain the object a.o which
    > instantiates a class from b1.o (or b2.o respectively), where b1.o and b2.o
    > have the same interface (header) and thus the symbol names are identical.
    > In order to be able to link lib1.a and lib2.a with main.cpp I tried to
    > localize the duplicated symbols (with GNU objcopy) and partially linked a.o
    > with b1.o and a.o with b2.o. This didn't work though.... somehow linking
    > both libs with the main-file eliminated b2.o's symbols.
    > So I tried to strip the localized symbols from the partially linked objects
    > before packing them into the lib but this didn't work, too... for some
    > reason objcopy complains that they are still required. What is going wrong?
    > Localizing the symbols and resolving them by partial linkage should make a
    > strip possible, or am I missing sth.?
    > I hope I made myself clear enough. Any ideas how to get this working? b1.o
    > and b2.o definitely need the same interface.
    >


    Bernd:

    Outside of the words `object', `class' and `instantiate' absolutely
    nothing about your question is topical here, where we speak of the
    standard C++ language.

    I would recommend posting to news:gnu.gcc.help or
    news:comp.unix.programmer for more info; you might want to try to put
    together a simplified concrete example of what you're trying to do as
    well (I suspect there's a better way of doing what you're trying to do).

    HTH,
    --ag


    --
    Artie Gold -- Austin, Texas
     
    Artie Gold, Aug 18, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Martin Pein

    Linking native libraries in Win2K

    Martin Pein, Oct 9, 2003, in forum: Java
    Replies:
    4
    Views:
    2,076
    Martin Pein
    Oct 14, 2003
  2. Albert
    Replies:
    4
    Views:
    522
    Mike Wahler
    Sep 29, 2003
  3. Replies:
    5
    Views:
    351
    James Kuyper
    Oct 25, 2008
  4. Marc Girod

    get local packages symbols with require

    Marc Girod, May 22, 2012, in forum: Perl Misc
    Replies:
    9
    Views:
    471
    Rainer Weikusat
    May 25, 2012
  5. David Froger

    shared libraries symbols visibility

    David Froger, Oct 30, 2013, in forum: Python
    Replies:
    0
    Views:
    86
    David Froger
    Oct 30, 2013
Loading...

Share This Page