Re: MSVC C++ name demangling



Tim Roberts wrote:
Soeren Meyer-Eppler <Soeren.Meyer-Eppler@xxxxxxxxxxxxx> wrote:

Questions:
- Is there an open source MSVC name demangler?

No, but every version of Visual Studio in the last 8 years has
included an "undname.exe" utility for exactly that purpose.

For VS98, it's in the "common\tools" directory. For VS2003 and
VS2005, it's in the "bin" directory with the command-line compiler.

Additionally if you want to do the same from your own code you can use this

extern "C"
char * _unDName(
char * outputString,
const char * name,
int maxStringLength,
void * (* pAlloc )(size_t),
void (* pFree )(void *),
unsigned short disableFlags);


const char * const pName = <decorated name>
char * const pTmpUndName = _unDName(0, pName, 0, malloc, free, 0x2800);
if (pTmpUndName)
{
//copy pTmpUndName somewhere, this is the undecorated name
free(pTmpUndName);
}

If your linker cannot find __unDName it is exported from VC CRT dll
(whatever its name is on your version).

Note that UnDecorateSymbolName you mentioned is a stripped down version of
__unDName. It can only handle a subset of possible C++ mangled names.

--
Eugene
http://www.gershnik.com



.