Help! How to Debug into the DLL built in C++ from C#?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear Great Experts,

I have a problem and need your help!

We have a Flat DLL built in C++ (CCC), and on top of it, we built another
DLL built in C# (SSS), which has .Net Assembly. CCC was imported into SSS.

Now we build applications using SSS as a reference, and we found some
problems exist in CCC.
From our applicatyion, We can Debug into SSS, but cannot go further into CCC.
In your opinion, what is the best solution for us to debug into CCC?

Please tell me what is the best solution in your opinion!
Your help is highly appreciated! Thanks in advance!
 
Hi Victor,
I believe you can go into unmanged code if you set the correct property in
your C# project.

Right click on your project in the solution explorer tree, then go to
Configuration Properties -> Debugging and there is an option called "Enable
unmanaged debugging"

You should be able to put a breakpoint before you enter your C++ dll and
stpe into the code.

Hope that helps
Mark R Dawson.
 
Mark,

Thank you very much for your quick reply!
I followed your instruction, but still could NOT step into the souce code in
CCC.DLL.
For both my application project and the SSS.dll, i selected the option
"Enable unmanaged debugging" before compiled them.

when i debug to the place calling a API in CCC.dll (which is called inside
an API in SSS.dll), and tried to step into CCC's API, a window popped up and
gave the following message:
"There is no source code available for the current location."
(This window has 3 buttons "OK" "Show Disassembly" "Help".)

In SSS, we import CCC.dll by using:
private const string strDllPath = ".\\CCC.dll";

The calling relationship in our application is as follows:
OurApplication(C#)
|--->APIs in SSS.dll (C#)
|--->APIs in CCC.dll(C++)

Could you please tell me if i made any mistake? Can we debug into Flat DLL?
In order to debug into CCC, what is the best and quickest solution for me?
For the 3 layer calling relationship above, can we debug into the bottom
layer?
Do i need to merge my application with SSS.DLL and call APIs in CCC directly?
Or, forget about C# part, go back to C++ and build a new application just to
test APIs in CCC.dll directly?

I really appreciate your time and kind help! Thanks again!

Best wishes,

Victor
--------------------------------------------
 
Hi Victor,
what that error means I believe, is that there is no debug information for
your c++ code, you will need to build the C++ in visual studio and make sure
you have built it in debug mode.

As for your structure, there should be no reason why you can't debug from
Application -> CCC -> SSS

Mark.
 
Back
Top