typeinfo problems due to different versions of gcc embeded into C API shared libraries

Milan Cvetkovic mcvetkovic@mpathix.com
Tue Dec 2 21:05:00 GMT 2003


Hi,
I wasn't sure if this is the correct mailing list for my question.

Operating system - Debian GNU Linux

I have a shared object library A.so.

This library has "C API" - I am only using C funcions to access this 
library. I am not even supposed to know it was implemented with C++.

+------------------------+            +--------------------+
|   My_code              |            | C library A.so     |
|       C++              |----------->| internaly compiled |
| compiled with g++-3.x  |            | with g++-2.95.3    |
+------------------------+            +--------------------+

My code is compiled with gcc-3.3.2.

When I link with A.so, anithing related to 
typeinfo/dynamic_cast/exceptions will not work, or worse, sometimes will 
work, and sometimes would core dump.

I have found that the problem is in A.so. It is internally using one of 
the previous releases of g++ (I believe g++-2.95.3), and it is exporting 
some C functions used by RTTI - I found one "__dynamic_cast".

Obviusly, __dynamic_cast-2.95.3 cannot work with my_code-3.3.2, since 
the ABI changed. But the names of __dynamic_cast remained the same, even 
though the signature changed. So my code links with obsolete 
__dynamic_cast, and it core dumps when used :((

Is there a way to overcome this problem?

Maybe in future releases of g++, the names of "C" functions related to 
ABI should "mangle" the ABI version, this would let others link with C 
libraries even though C++ ABI would have changed in the mean time.

Or there is more to this than I can see now?

Any hints, ideas or thoughts would be gratly appreciated

Thanks, Milan.



More information about the Libstdc++ mailing list