Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / September 2007

Tip: Looking for answers? Try searching our database.

Stepping into vc++ dll from c#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mk - 10 Sep 2007 14:56 GMT
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.
Ben Voigt [C++ MVP] - 10 Sep 2007 15:03 GMT
>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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.