FFI question

Ian Piumarta ian.piumarta at inria.fr
Mon May 3 18:07:41 UTC 2004

On 03 May 2004, at 09:26, Andreas Raab wrote:

> Wait a second - isn't name mangling standardized? I cannot imagine how 
> you'd
> link against a C++ library if each compiler mangles the name in the 
> way he
> wants to...

The standard does not specify anything about mangling.  Each vendor is 
free to implement whatever scheme they want (and change it between 
compiler releases if it amuses them to do so).

There are at least 2 schemes implemented by different versions of gcc:

   gcc-2.95       _foo__Fi
   gcc-3.3        __Z3fooi

Anyone who recently upgraded, e.g., a Linux/GNU system to a series 3 
gcc will no doubt have seen all the warnings about having to reinstall 
system libs and recompile all user libs built with the older compiler.

To add insult to injury, the gcc folks appear to like changing the C++ 
ABI from time to time too, which makes for even more incompatibility 
between releases.

In short: no, you cannot mix C++ binary compiled with incompatible 
compiler (versions) on the same machine or OS.


More information about the Squeak-dev mailing list