I created MFCApp using the VS2008 wizard. Inside my application, "InitInstance ()", I call the LoadLibraryA () method because I need to load multiple DLL files. But as soon as I call "LoadLibraryA ()", it again calls the "InitInstance ()" of my application and, therefore, it becomes infinite recursive material. Is there something I'm doing wrong?
BOOL CLoader_MFCApp::InitInstance()
{
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinAppEx::InitInstance();
SetRegistryKey(_T("MyApp"));
HMODULE hm = LoadLibraryA("./abc/def.dll");
return FALSE;
}
Call stack:
MyApp.exe!CLoader_MFCApp::InitInstance() C++
CORE.dll!InternalDllMain(HINSTANCE__ *, unsigned long, void *) C++
CORE.dll!__DllMainCRTStartup(void *, unsigned long, void *) C
CORE.dll!_DllMainCRTStartup(void *, unsigned long, void *) C
ntdll.dll!_LdrpCallInitRoutine@16()
ntdll.dll!_LdrpRunInitializeRoutines@4()
ntdll.dll!_LdrpLoadDll@24()
ntdll.dll!_LdrLoadDll@16()
kernel32.dll!_LoadLibraryExW@12()
kernel32.dll!_LoadLibraryExA@12()
kernel32.dll!_LoadLibraryA@4()
MyApp.exe!CLoader_MFCApp::InitInstance() C++
mfc90.dll!AfxWinMain(HINSTANCE__ *, HINSTANCE__ *, char *, int) C++
MyApp.exe!__tmainCRTStartup() C
kernel32.dll!_BaseProcessStart@4()
"Def.dll" is any other dll and is not completely associated with MyApp. In this case, I am trying to load another dll "CORE.dll"
, , , LoadLibrary InitInstance. - () , InitInstance??? , LoadLibrary ...