cmdline
cmdline copied to clipboard
ABI dependency
Is it really required to depend on cxxabi.h? Non-gcc projects hit the wall here. Removed the problematic code regarding typename demangling. Interested in a contribution? One could provide a conditional compilation for this code.
If you remove the cxxabi.h include and add around the original demangle function, it'll work on Windows too:
#ifndef WIN32
#include <cxxabi.h>
static inline std::string demangle(const std::string &name)
{
int status=0;
char *p=abi::__cxa_demangle(name.c_str(), 0, 0, &status);
std::string ret(p);
free(p);
return ret;
}
#else
#include <windows.h>
#include <Dbghelp.h>
#pragma comment(lib,"dbghelp.lib")
static inline std::string demangle(const std::string &name)
{
TCHAR szUndecorateName[256];
memset(szUndecorateName, 0, 256);
UnDecorateSymbolName(name.c_str(), szUndecorateName, 256, 0);
return szUndecorateName;
}
#endif