I need to debug a native vc++ dll used in a c# app winforms app. The c# app
employs DllImportAttribute, and static extern int, to define the functions it
calls from the vc++ dll.
The vc++ dll is not referenced, nor does it use com to communicate, rather
it registers the windows handle with the dll and uses a WndProc override to
receive windows messages from the event.
I tried building the dll in full debug, and dropping it into the c' apps
debug directory in order to step into the dll's methods, but unfortunately I
got the following message:
LoaderLock was detected
Message: Attempting managed execution inside OS Loader lock. Do not attempt
to run managed code inside a DllMain or image initialization function since
doing so can cause the application to hang.
Can anyone provide any help as to what I need to do in order to step from
the c# app into the vc++ dll's functions.
Thanks.
>I need to debug a native vc++ dll used in a c# app winforms app. The c#
>app
[quoted text clipped - 17 lines]
> since
> doing so can cause the application to hang.
Did you make the C++ dll?
Is it possible that it isn't really a native dll, but uses .NET? Use
dependency walker to check, you'll see the .net runtime engine (clr,
mscoree) imported if it uses .net inside.
> Can anyone provide any help as to what I need to do in order to step from
> the c# app into the vc++ dll's functions.
Enable unmanaged debugging on the Debug tab of your main .exe project.
> Thanks.
mk - 10 Sep 2007 16:20 GMT
Hi,
Thanks for the quick response. It is actually a native dll, written by
another team at work, no clr aspects whatsoever. Its turned out, however,
that I was able to trace the error to an input given to the vc++ dll, and
thankfully don't need to hack the debugging.
Kind regards,
mk
> >I need to debug a native vc++ dll used in a c# app winforms app. The c#
> >app
[quoted text clipped - 30 lines]
>
> > Thanks.