[Top][All Lists]

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

Linking libraries compiled by different versions of gcc together

From: brusch
Subject: Linking libraries compiled by different versions of gcc together
Date: 21 Mar 2006 07:34:23 -0800
User-agent: G2/0.2


I have a library which is compiled using gcc version 2.96 (or 2.95.3).
There is no access to the source code of this lib.
Let's name it "libold.a".

It uses other libraries which are also compiled using gcc version 2.96.
Let's use for the example only one old lib, name it "libolddepend.a".

The platform for building the old libs was RedHat version 7.3.

I try to link these library into a project which should be compiled and
linked using gcc version 4.1.0. (Or, maybe, version 3.x).
Given all object files of the new project contained in "libnew.a".

The project depends also on libraries compiled with gcc 4.1.0, let's
take "libnewdepend.a".

I have installed gcc-versions 2.95.3, 3.4.5 and 4.1.0 one after
"gcc -V2.95.3" calls gcc version 2.95.3, "gcc" calls version 4.1.0.

I already built a plain "C"-linkage interface around the old library to
avoid problems arising from different name mangling of the different
C++-compilers. ("plain_c.o", compiled using gcc version 2.95.3)

The main function should be in file "main.o".

How is it possible to link the files together, so usage (<) is as
        - libold.a < libolddepend.a < old libc.a, libc++ etc.
        - plainc.o < libold.a
        - libnew.a < libnewdepend.a < new libc.a, libc++ etc.
        - main.o < libnew.a < libold.a

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.
Could somebody show me a way out?

(I currently try this on Fedora Core 4.)

Michael B.

reply via email to

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