Debugging DLLs in VS 2003

Started by
4 comments, last by Telamon 20 years ago
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

Shedletsky's Bits: A Blog | ROBLOX | Twitter
Time held me green and dying
Though I sang in my chains like the sea...

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

Shedletsky's Bits: A Blog | ROBLOX | Twitter
Time held me green and dying
Though I sang in my chains like the sea...

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.

Brianmiserere nostri Domine miserere nostri
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.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
Yeah, I noticed. Still, the IDE should detect where I have breakpoints (managed/unmanaged sections) and pick the right debug mode.

Shedletsky's Bits: A Blog | ROBLOX | Twitter
Time held me green and dying
Though I sang in my chains like the sea...

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.

This topic is closed to new replies.

Advertisement