HighTechTalks DotNet Forums  

A mixed dll loading problem (after I configured app compatibility)

Dotnet Framework (CLR) microsoft.public.dotnet.framework.clr


Discuss A mixed dll loading problem (after I configured app compatibility) in the Dotnet Framework (CLR) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
dotNeter
 
Posts: n/a

Default A mixed dll loading problem (after I configured app compatibility) - 07-01-2006 , 09:33 AM






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.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.