473,500 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Linking libraries with local symbols

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
1 1876
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1670
by: sunil | last post by:
Hi, We have lot of c and fortran archive libraries that have complex dependencies. We have different server tasks that use some of these libraries. We have developed a tool inhouse that links...
3
10298
by: daniel_shaw01 | last post by:
I want to link the C++ standard libraries statically for my application because I don't space for the .so files on my target platform. After quite a bit of searching, I found very little...
20
3194
by: Steven T. Hatton | last post by:
I just read this in the description of how C++ is supposed to be implemented: "All external object and function references are resolved. Library components are linked to satisfy external...
1
1292
by: Yi | last post by:
We are trying to make a library of our own and are getting lots of missing symbol errors. The missing symbols are functions from UCSC libraries that are included from our library. The library...
3
964
by: Paolo | last post by:
Hi all! I have a problem with a project under VS 2005. I downloaded 2 projects, one is a MFC .lib project and another one is an .exe that uses this lib file. I need to edit those projects, but...
3
5083
by: Charles Nicholson | last post by:
Hello all- I have some static C++ libraries that I wrote in VS2003 but which upgraded fine when i went to VS2005 Pro. In them i overload the global versions of operators new, new, delete, and...
10
2652
by: Julian | last post by:
I get the following error when i try to link a fortran library to a c++ code in .NET 2005. LINK : fatal error LNK1104: cannot open file 'libc.lib' the code was working fine when built using...
0
2540
by: Philip Lowman | last post by:
I am in the process of trying to migrate a couple of build solutions to Visual Studio Express 2005 from VS 2003 Professional and I am running into a weird C/C++ runtime library linking issue when...
2
2435
by: Jim Johnson | last post by:
C++ linking works by using Linker to combine object files into single exe file. Does each .cpp file compile to a single .obj file? If the .cpp code called functions in some library (.lib) does...
0
7149
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7021
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7207
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7242
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
4928
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4619
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3114
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1434
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
318
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.