I try to compile a skeleton DLL in Visual C++ 2010. I disabled precompiled headers (I have reasons to do that) and compile DLL with one function with trivial body. However, compilation failed on file dllmain.cpp with a lot of errors like that:
\microsoft visual studio 10.0\vc\include\cstring(18): error C2039: 'memchr' : is not a member of '`global namespace''
My dllmain.cpp code follows:
// dllmain.cpp : Defines the entry point for the DLL application.
#include <Windows.h>
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
For me it looks like this code never calls any string-related functions, so why does Visual C++ access CString during its compilation at all and why does it search for memchr function? Compiler command line from log follows:
CL.exe /c /ZI /nologo /W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _WINDOWS /D _USRDLL /D MYDLL_EXPORTS /D _WINDLL /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt dllmain.cpp