...
When you have a dll, you typically have initialization code like the following:BOOL APIENTRY DllMain( HANDLE hModule,
DWORD DWORD ul_reason_for_call,
LPVOID 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;
}
Using this code to initialize and free LM-X handles can cause LMX_Free to hang when using the DETACH handlers, because the OS can close threads without passing the information to the LM-X library. You should instead initialize LM-X by explicitly calling code to initialize and free LM-X from the exported dll interface.