By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,134 Members | 1,796 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,134 IT Pros & Developers. It's quick & easy.

Linking libraries with local symbols

P: n/a
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

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.