|Name mangling email@example.com (Young Wei Kuan) (2001-07-01)|
|Re: Name mangling firstname.lastname@example.org (Thant Tessman) (2001-07-02)|
|Re: Name mangling email@example.com.OZ.AU (2001-07-03)|
|Re: Name mangling firstname.lastname@example.org (Toon Moene) (2001-07-06)|
|Re: Name mangling email@example.com (Alain Miniussi) (2001-07-06)|
|Re: Name mangling firstname.lastname@example.org (Gabriel Dos Reis) (2001-07-17)|
|Re: Name mangling email@example.com (Alain Miniussi) (2001-07-18)|
|Re: Name mangling firstname.lastname@example.org (Gabriel Dos Reis) (2001-07-23)|
|From:||Thant Tessman <email@example.com>|
|Date:||2 Jul 2001 12:30:52 -0400|
|Keywords:||GCC, C++, debug|
|Posted-Date:||02 Jul 2001 12:30:52 EDT|
Young Wei Kuan wrote:
> I understand g++ 3.0 has changed its name-mangling scheme.
> Can anyone explains what name mangling does exactly? Why is
> it that object code compiled by g++ 2.95 is incompatible with
> that of gcc3.0?
In C++ you can define several functions that all use the same name,
but apply to different argument types (or reside in different
namespaces). Since C++ implementations typically use C-style linkers,
a trick for making sure these overloaded names are unique is to build
a new name out of the old name and the argument types. This is called
Since you're using g++ you probably have access to 'nm' and 'c++filt'.
You can use the 'nm' utility on a C++ executable to see the mangled
names, and you can use the 'c++filt' utility to translate the mangled
names into their original C++ syntax.
The C++ standard doesn't mandate how these names are to be built, so
different compilers, and even different revisions of the same compiler
may use different mangling algorithms.
If you want to call a C function from a C++ program, you need to use
the 'extern "C"' declaration. This basically tells the compiler to
turn off name mangling.
Hope this helps.
Return to the
Search the comp.compilers archives again.