1

I am trying to debug some problems in a native C++ COM DLL I have created and would like to launch the Visual Studio (2008) debugger from this. This dll is called by another dll that I was given, so basically my code plugs into another application through this. Anyway, in the past I had used C# to create this dll and was able to use the System.Diagnostics.Debugger.Break() method. Is there anything similar to this that can be used? I saw a few posts about DebugBreak and __debugbreak but this did not seem to work, it just appeared to stop my code from executing beyond that statement.

EDT: I followed the advice of paulsm4 below and found that the breakpoints did not work, it would tell me: "The breakpoint will not currently be hit. No Symbols have been loaded for this document"

1 Answer 1

1

Ideally, you'll have the project source for your COM/ActiveX .dll.

If that's the case, just set a break point in your .dll code, run your program in the debugger ... and that's it.

Please note the distinction between "managed code" (e.g. a C#/.net .exe or .dll) and "native code" (like your COM/ActiveX .dll). To debug "native code" under MSVS2008, you'll need to specify "mixed mode":

http://msdn.microsoft.com/en-us/library/kbaht4dh%28v=vs.90%29.aspx

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks for the information. I will give it a try. I have the source code for the COM .dll but nothing else. I am new to using the visual studio debugger so I have a big dumb question here, how do I run the program in the debugger. when I have used it for executables I have written I just start debugging, but I do not know how to start this other application through it.
Ok, I think I figure that part out by adding it to the debugger command path for my project. I will give it a try.
I just realized this might be more complicated than I thought. When debugging I found that the DLL that calls my DLL is not started by the application, but by a service that is started by the application. Do I somehow need to make the debugger aware of this?
You can attach to a running process with the debugger: MSVC, open your .dll project, Select "Debug" > "Attach to Process" > browse to your running process.
I tried attaching the service but my breakpoint still was not available. Still not clear to me why as the error appears to be pretty generic.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.