0

hey guys i am working on an application and i removed the CRT to save alot of space in the executable and making it as small as possible :) the thing is that when i removed the CRT i also received tons of errors on unresolved external and i was able to remove most of them just by adding a few operators like these:

void * __cdecl operator new(unsigned int bytes) {
  return HeapAlloc(GetProcessHeap(), 0, bytes);
}

void __cdecl operator delete(void *ptr) {
  if(ptr) HeapFree(GetProcessHeap(), 0, ptr);
}

extern "C" int __cdecl __purecall(void) {
  return 0;
}

extern "C" const DWORD_PTR __security_cookie = 0xE64EBB40;

extern "C" void __fastcall __security_check_cookie(DWORD_PTR cookie) {
    if (cookie != __security_cookie)
        __asm int 3;
}

but now i am stuck with the last three errors and i have no clue on how to solve them, and one that i am really curious of is the _memmove error ? i am not using the memmove operator anywhere in my code so i have not clue why i am receiving it :P

atleast here are the errors, i would be very greatefull for your answers.

Error   2   error LNK2001: unresolved external symbol "void __cdecl std::_Xbad_alloc(void)" (?_Xbad_alloc@std@@YAXXZ)   C:\Users\Fluttershy!\documents\visual studio 2012\Projects\PincelStub\PincelStub\PincelStub.obj
Error   3   error LNK2001: unresolved external symbol "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPBD@Z)  C:\Users\Fluttershy!\documents\visual studio 2012\Projects\PincelStub\PincelStub\PincelStub.obj
Error   4   error LNK2001: unresolved external symbol _memmove  C:\Users\Fluttershy!\documents\visual studio 2012\Projects\PincelStub\PincelStub\PincelStub.obj
4

2 回答 2

1

VC++ 可能会在内部使用这些(例如,前两个用于指示错误条件_memmove,以及在普通旧struct分配中移动内存块)。前两个,我只是定义为{},但至于最后一个,我会尝试摆弄优化选项(关于“内在函数”等的东西)或完全重新实现它(不仅仅是存根)。

于 2013-06-22T13:27:05.630 回答
0

我不知道你为什么要朝自己的腿开枪,但无论如何。CRT 的源代码就在那里,因此您可以搜索它以查找丢失的内容并进行复制。memmove 功能应该很明显。另外两个看起来像连接到标准异常。

于 2013-06-22T13:29:30.973 回答