MFC Shared DLLS, application A load the DLL, shows the window, everything is normal, when loading DLL application B has loaded the initialization of A DLL, to crash the B of uncertainty, how to make B loading has not been initialized DLL,
thank you
CodePudding user response:
The following example demonstrates how to structure The DLL entry - point function.BOOL WINAPI DllMain (
HINSTANCE hinstDLL,//handle to the DLL module
DWORD fdwReason,//"reason for calling the function
LPVOID lpReserved)//reserved
{
//Perform actions -based on the reason for calling.
The switch (fdwReason)
{
Case DLL_PROCESS_ATTACH:
//Initialize once for each new process.
//Return FALSE to fail DLL load.
break;
Case DLL_THREAD_ATTACH:
//Do the thread - specific initialization.
break;
Case DLL_THREAD_DETACH:
//Do the thread - specific cleanup.
break;
Case DLL_PROCESS_DETACH:
//Perform any necessary cleanup.
break;
}
Return TRUE;//Successful DLL_PROCESS_ATTACH.
}
?
CodePudding user response:
MSDN98_1. ISO http://pan.baidu.com/s/1dDF41ix, MSDN98_2. ISO http://pan.baidu.com/s/1bnGo0Vl