Hi guys, I have a problem may be a problem of mixed dll loading.
Once I configred my app compatibility mode with "running under
window2k", it threw a 0xc0000005 exception at the moment it was
launched. The concrete exception description was,
The application failed to initialize properly (0xc0000005). Click on OK
to terminate the application.
I used windbg to analyze what happened. Finally, I found the difference
between with/without app compatibility configuration.
My application exited at crtdll.c,
BOOL WINAPI _CRT_INIT(HANDLE hDllHandle, DWORD dwReason, LPVOID
lpreserved)
{
.....
if (__native_startup_state != __uninitialized)
{
_amsg_exit( _RT_CRT_INIT_CONFLICT);
}
else
{
/* Set the native startup state to initializing. */
__native_startup_state = __initializing;
...
}
.....
}
1) without compatibility configuration, it worked well.
2) with compatibility configuration, just when loading dll, the app
stopped at the preceding code. The variable __native_startup_state's
value was __initialized, so the flow went to _amsg_exit, then threw a
0xC0000005 exception. But in normal case, it was still __uninitialized
at the moment, so everything was ok.
I think the preceding code implied there was sth wrong with CRT
intialization, or incorrect initialization sequence (native code and
managed code).
I am not sure if it exactly matched the case described in,
http://msdn.microsoft.com/library/de...ingProblem.asp
Besides, I tried adding the following switched onto the linker when
building mixed dll,
NOENTRY msvcrt.lib /NODEFAULTLIB:nochkclr.obj
/INCLUDE:__DllMainCRTStartup@12
but useless.
I'm not good at this field, can someone give me some help?
My platform is WinXP SP2, VS2005. My project includes pure native
dll, mixed dll and pure managed dll. The problem occured while the app
was loading the dll.
thx in advance.