help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linking libraries compiled by different versions of gcc together


From: Paul Pluzhnikov
Subject: Re: Linking libraries compiled by different versions of gcc together
Date: Tue, 21 Mar 2006 13:54:44 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

"brusch" <brusch4@gmx.net> writes:

> I have a library which is compiled using gcc version 2.96 (or 2.95.3).

Your message (further down) implies that the library contains C++.
C++ code compiled with different compilers (gcc-2.95 and 3.x
*are* different compilers for all practical purposes), is *not*
link compatible.

> There is no access to the source code of this lib.
> Let's name it "libold.a".

Your best bet is to continue using whatever compiler libold.a was
compiled with.

> There should be a way using a shared object which contains all old
> dependencies and using "plainc.o" as filter, but I don't know how.

You can't use plainc.o as a filter.

On Linux/x86 (but not x86_64) you could link libold.a,
libstdc++-old.a  and plainc.o into libold.so, and carefully hide
(using linker version scripts) all traces of non-C interfaces inside
the DSO, leaving only plain-C exposed, and then use the resulting
DSO with the new version of g++.

This shouldn't be too difficult, but isn't entirely trivial either.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]