[GCC-XML] Other mangling?

Brad King brad.king at kitware.com
Sun Feb 20 11:28:21 EST 2005


Thomas Menguy wrote:
> gccxml is said to "emulate" other compiler, like MS VC 6 and .NET ? 
> how is it done, what is the principle?
> If done is there a way to have the mangling of those compiler (very
> different from the gcc one) ?

GCC-XML simulates the preprocessing behavior of the other compilers so 
that the dump includes the system headers associated with a particular 
compiler.  If your code includes lines like

#if defined(__GNUC__)
...
#elif defined(_MSC_VER)
...
#endif

then even though GCC-XML uses GCC as a parser, the second block would be 
chosen if you were simulating MSVC.  This was necessary to give a 
complete representation of the interface as seen by a particular 
compiler.  For example, if STL is used in a C++ interface, the true 
interface includes the details of a particular compiler's STL 
implementation.  GCC-XML captures this knowledge by using the compiler's 
system headers.

Unfortunately it is not possible to get the mangled names provided by 
the other compilers.  Since you said you are trying to develop 
component-based technology I'm guessing you are interested in generating 
some kind of binary introspection tool.  You should be aware that there 
is alot more in an ABI (application binary interface) than just the C++ 
name mangling.  There are compiler-specific implementations of virtual 
functions, exceptions, pointer-to-member types, etc...

Good luck,
-Brad



More information about the gccxml mailing list