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

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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/default.asp?url=/library/en-us/dv_vstechart/html/vcconMixedDLLLoadingProblem.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.

.



Relevant Pages

  • Re: Configuration for DLL
    ... The classes in the DLL will be used by VBScripts. ... How can I get it to look at the installation directory? ... assembly is called "MyConnection.dll" create a configuration ... Add your connection string to it: ...
    (microsoft.public.dotnet.general)
  • RE: MSTest with codecoverage - attempts to instruments DLLs it cant
    ... of the assembly use some unmanaged DLL, ... Generally for the Instrumentation and Code coverage, ... save a copy of the configuration file. ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.vsnet.general)
  • Re: Dynamic DLL Loading or Static ?
    ... Loading it on demand the cuts down on load time for the app and on memory foot ... the DLL contains functionality that depends on specific platform features. ... There are two areas where static and dynamic loading differ. ... If you use static loading the DLL will be loaded and its Initialization ...
    (borland.public.delphi.nativeapi)
  • Re: Dynamic DLL Loading or Static ?
    ... A DLL is dynamic linked always: ... terms are load-time dynamic linking and run-time dynamic linking. ... > initialize this DLL and I'm loading it dynamically. ... This is the default value for WinXP SP1 and WinSrv03. ...
    (borland.public.delphi.nativeapi)
  • Re: Network Drive Issue
    ... > CHKDSK isn't sufficient to determin the heath of the drive. ... This is related to some network device driver ... renamed to disable it in VS 2005 due to slow and long delay loading ... the last DLL loaded is FEACP.DLL as well. ...
    (microsoft.public.win32.programmer.kernel)