Solved

How can I debug, step through a C++ DLL that I pinvkie?

Posted on 2006-11-07
5
173 Views
Last Modified: 2010-04-16
Hi, I'm getting that now source code is avialbe when I want to step into my C++ DLL that I pinvok in my C# application.  How can I so this?  I'm using vs2005, .net 2.0  Thanks.
0
Comment
Question by:lapucca
  • 3
  • 2
5 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
ID: 17896000
Open C++ Dll project, set C# client as executable for debugging: Project - Properties - Configuration Properties - Debugging - Command. Type here C# executable name. Set breakpoint in unmanaged function and select "Start Debugging".
0
 

Author Comment

by:lapucca
ID: 17900532
I followed your insstructions and the calling appl starts but I didn't stop at my breakpoin in the unmagaed code and I'm just getting the error message as if I'm just running the C# application directly.  What else can I check?  Thank you.
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 17900615
What error message? Are you sure that unmanaged function is called? If there is some interoperability problem, aplication can crash before unmanaged function is called.
To test this, add OutputDebugString call to the beginning of unmanaged function, and run with DebugView program:
http://www.microsoft.com/technet/sysinternals/utilities/DebugView.mspx
0
 

Author Comment

by:lapucca
ID: 17900649
It calls the  the unMaged function for sure.  I stepped through the c# application and got the same error message when the unmanaged function is called.  It doesn't crash the application.  The error message just says Login fail: unknown userid and password.  This is what I'm trying to locate in the unmanaged function as where is this happening.   The error message is put out from the unmanaged function definitely.  Thanks.
0
 

Author Comment

by:lapucca
ID: 17902055
I have no idea what I did but I am now able to step through the Unmanaged code from my C# application.  I swear that I wasn't able to do this last night and this morning.  Thanks.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now