Примеры ошибок, обнаруженных с помощью диагностики V718
V718. The 'Foo' function should not be called from 'DllMain' function.
LibreOffice
V718 The 'CreateThread' function should not be called from 'DllMain' function. dllentry.c 308
BOOL WINAPI DllMain( HINSTANCE hinstDLL,
DWORD fdwReason, LPVOID lpvReserved )
{
....
CreateThread( NULL, 0, ParentMonitorThreadProc,
(LPVOID)dwParentProcessId, 0, &dwThreadId );
....
}
Open X-Ray Engine
V718 The 'CoInitializeEx' function should not be called from 'DllMain' function. xrcore.cpp 205
#ifdef _EDITOR
BOOL WINAPI DllEntryPoint(....)
#else
BOOL WINAPI DllMain(....)
#endif
{
switch (ul_reason_for_call)
{
....
case DLL_THREAD_ATTACH:
if (!strstr(GetCommandLine(), "-editor"))
CoInitializeEx(NULL, COINIT_MULTITHREADED);
timeBeginPeriod(1);
break;
....
}
return TRUE;
}