After removing the CRT from my DLL I have gotten these weird errors.
Here are they:
- LNK2001 unresolved external symbol "void __cdecl std::_Xbad_alloc(void)" (?_Xbad_alloc@std@@YAXXZ)
- LNK2001 unresolved external symbol "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPBD@Z)
- LNK2001 unresolved external symbol "void __cdecl std::_Xout_of_range(char const *)" (?_Xout_of_range@std@@YAXPBD@Z)
- unresolved external symbol __dtest
- unresolved external symbol __fdtest
- unresolved external symbol __invalid_parameter)noinfo_noreturn
- unresolved external symbol __stdio_common_vsnprintf_s
- unresolved external symbol __stdio_common_vsprintf
- unresolved external symbol __std_terminate
If I understand correctly the Xbad_alloc
and Xlength_error
are because of the new
and delete
operators? In that case I create my class instance like this:
class sc_Core
{
public:
static sc_Core *Instance(void);
func A();
public:
void *operator new(size_t si)
{
return HeapAlloc(GetProcessHeap(), NULL, si);
}
void operator delete(void *pv) throw()
{
HeapFree(GetProcessHeap(), NULL, pv);
}
private:
sc_Core(void) { }
~sc_Core(void) { }
sc_Core(const sc_Core&) { }
sc_Core(sc_Core&&) {}
sc_Core& operator=(const sc_Core&) {}
sc_Core& operator=(sc_Core&&) {}
static sc_Core *p_Instance;
};
// Global Scope
sc_Core *sc_Core::p_Instance = nullptr;
sc_Core *sc_Core::Instance(void)
{
if (p_Instance == nullptr)
p_Instance = new sc_Core();
return p_Instance;
}
If anyone knows how these occur or how I can fix them it would be very much appreciated!