• Advertisement

Archived

This topic is now archived and is closed to further replies.

Debugging DLLs in VS 2003

This topic is 5027 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have two separate projects in a solution. The first is a DLL that I am writing in C++. The second is a C# program that calls functions exported by my DLL. This works great. My problem is that if I set a break point in the DLL, and run in debug mode, it is completely ignored. I can''t debug the DLL at all. From the information that I have found on the internet, it seems that as long as both projects are in the same solution, this should just magically work. Any suggestions? ---------------------------------------- Let be be finale of seem, seems to me. ---------------------------------------- Shedletsky''s Code Library: Open source projects and demos

Share this post


Link to post
Share on other sites
Advertisement
After poking around a bit more, I found the answer. I''m posting it here so this problem won''t bite anyone else.

It turns out that to debug unmanaged code, there is a toggle in the client project debug settings that needs to be flipped. Why this has to be flipped by hand when it is obvious that you are using unmanaged code and you want to debug it is beyond me. Are smarter tools too much to ask for?

----------------------------------------
Let be be finale of seem, seems to me.
----------------------------------------

Shedletsky''s Code Library:

Open source projects and demos

Share this post


Link to post
Share on other sites
One reason that can happen is that breakpoints in your .dll source are not valid until the .dll is loaded. In other words, you have to set your breakpoint (or turn it back on) *after* LoadLibrary returns.

.dlls that are loaded automatically at the start of your program don''t suffer from this, but one''s you load dynamically at runtime (i.e. by calling LoadLibrary) do.

Share this post


Link to post
Share on other sites
quote:
Original post by Telamon
It turns out that to debug unmanaged code, there is a toggle in the client project debug settings that needs to be flipped. Why this has to be flipped by hand when it is obvious that you are using unmanaged code and you want to debug it is beyond me. Are smarter tools too much to ask for?

Mixed-mode debugging is a lot slower than plain native debugging or plain managed debugging.

Share this post


Link to post
Share on other sites
Yeah, I noticed. Still, the IDE should detect where I have breakpoints (managed/unmanaged sections) and pick the right debug mode.

Share this post


Link to post
Share on other sites
I disagree. If the IDE did that, I''d have to reset all my breakpoints every time I wanted to disable debugging native code. That would be annoying.

Share this post


Link to post
Share on other sites

  • Advertisement