Thanks to KK for his help. :D

I just notice a few things while linking to msvcrt.lib in the 2008 WDK:

~ If you were statically linking to the C++ library (libcpmt.lib), there is this error of this unresolved external symbol:

__calloc_crt referenced in __Getctype

so I browsed through libcmt.lib. Alas, my problems got worse, so I was forced to write my own copy of this function.

My code appears here, in blue:

#include <stdlib.h>

#include <malloc.h>

extern “C” void* __cdecl _calloc_crt(size_t a, size_t b)

{

return calloc(a, b);

}

I notice this code works perfectly I use it, but as always, no piece of code is correct for everyone.

~ Also, you may get an unresolved function at runtime:

_except_handler4_common could not be located in Msvcrt.dll .

It is because, as was mentioned in KK’s blog, this (plus a bunch more) is only available in the Vista version of the CRT DLL. So, I pilled some .obj files from libcmt.lib and compiled them into one library; they work as expected. I will post the library online some time.

Leave a Reply