cmdline icon indicating copy to clipboard operation
cmdline copied to clipboard

ABI dependency

Open malleor opened this issue 13 years ago • 1 comments

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.

malleor avatar Mar 11 '13 13:03 malleor

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

adishavit avatar Oct 01 '15 11:10 adishavit