This is the mail archive of the
mailing list for the GCC project.
Re: gcc34 and older libraries
- From: Eljay Love-Jensen <eljay at adobe dot com>
- To: Øåáåêî Åâãåíèé<shebeko at mail dot ru>, gcc-help at gcc dot gnu dot org
- Date: Fri, 04 Jun 2004 06:22:57 -0500
- Subject: Re: gcc34 and older libraries
- References: <email@example.com>
>Is it possible?
Short answer: no, it is not possible to use GCC 2.95 C++ libraries with
GCC 3.x compiled C++ code.
Long answer: yes, it is possible. But you don't want to do it.
To make it possible requires making a C thunk layer which interfaces to the
GCC 2.95 C++ libraries (compiled with GCC 2.95, obviously), then link
against the C thunk libraries with GCC 3.x.
If you want the C thunk libraries to behave "C++ ish", you'll need to write
a C++ wrapper over the C thunk library, which your wrappers and your C++
code compiled with GCC 3.x uses.
You'll have to handle each exception with kid's gloves, since exceptions
cannot propagate over a C barrier (they couldn't propagate anyway, since
the GCC 2.95 C++ ABIs are different from the GCC 3.x C++ ABI). You'll need
to catch them in your GCC 2.95 C thunk layer, serialize them to your C++
wrapper which then can reconstitute them in your GCC 3.x world.
Note: GCC 3.x C++ ABIs have some differences as well. I think 3.0.x is
one ABI, 3.1.x is another, 3.2.x-3.4.x is yet another. If I remember
correctly. It's documented somewhere.
Also, RTTI and dynamic casting will have issues as well. You'll need to
treat them with kids gloves as well.
And if you do things JUST right, you'll also get to shoot yourself in the
foot by having different heap managers involved. *laugh*
You may say, "Yikes, that's a lot of work! No one would do that!"
In my job, I do it all the time. And it is a lot of work. I wouldn't wish
it on anyone.