Debug a Native DLL written in VC++.NET 2010 Express called from a VB.NET .exe file
The saga continues. Sometimes I think I must be the first person in the world to convert a VB6 project that calls a VC++ DLL into the new and exciting (ie really irritating) .net versions, namely vb.net and vc++.net
In VC++ 6.0 you could set the debug version of the calling VB6 .exe and then trace it through the dll step by step like this:
Project --> Settings --> Debug --> Executable for Debug Session
Now,according to Microsoft you cannot do this in 2010 Express version of vc++.net but you CAN (they say) put a break in the vc++.net dll then start your exe in vb.net and it will step into it
Well, when I try it, it does NOT go into the DLL when I press F8 - anybody know the trick?
(I am using 2010 Express because I am on XP because I still need VB6 and it will not install the VB6 IDE in Win 7/8)
Edit:
Well, it seems that in vb.net, if you right click when you get to the line of code that calls the function in your dll, you get the following option (in my case):
Step Into Specific: MOPEKS.prjDLLs.TestF
where "MOPEKS.prjDLLs" is the module in my code that includes TestF. So, I do this and press it, whereupon, according to Microsoft it should go into the function TestF. Of course, it doesn't but this does sound like progress of a sort
Advance the execution point to the function call you want to step into. (You might use a breakpoint, Step Into, Step Over, or Run To Cursor.)
Right-click the source window to open the shortcut menu.
Click Step Into Specific and choose the function you want from the submenu.
The debugger executes the function call and breaks at the beginning of the selected function. The Step Into Specific command appears only if the execution point is located on a line of code that contains a nested function.
I have a horrible feeling that maybe it is disabled in the Freebie versions (ie Express 2010 in my case)
Last edited by wavering; August 7th, 2014 at 07:34 AM.
MOPEKS - a freeware program that generates programs that use each other to solve problems. Is this the correct route to a genuinely intelligent machine?
Re: Debug a Native DLL written in VC++.NET 2010 Express called from a VB.NET .exe fil
Yes, I have tried this and still cannot get into the DLL ... but thanks for the suggestion
MOPEKS - a freeware program that generates programs that use each other to solve problems. Is this the correct route to a genuinely intelligent machine?
Re: Debug a Native DLL written in VC++.NET 2010 Express called from a VB.NET .exe fil
You need to make sure you deal with correct dll.
Set your dll as default project in the solution. Specify the path to your VB.NET exe for running dll project. Set a breakpoint in dll code. Run the debugging session and see if the breakpoint activates (becomes bold). In case it's not (breakpoint bullet remains hollow), your exe loads similar dll from somewhere else. You can find out the location from Modules pane.
Re: Debug a Native DLL written in VC++.NET 2010 Express called from a VB.NET .exe fil
Originally Posted by Igor Vartanov
You need to make sure you deal with correct dll.
Yes, I really, really do have the correct version of the DLL
Originally Posted by Igor Vartanov
Set your dll as default project in the solution.
I don't understand ...
Originally Posted by Igor Vartanov
Specify the path to your VB.NET exe for running dll project.
How do I do that? If you can answer that for VC++.net 2010 Express I will be eternally grateful ...
Originally Posted by Igor Vartanov
Set a breakpoint in dll code. Run the debugging session and see if the breakpoint activates (becomes bold).
Yes, been doing that ...
Originally Posted by Igor Vartanov
In case it's not (breakpoint bullet remains hollow), your exe loads similar dll from somewhere else. You can find out the location from Modules pane.
I am confident it is the correct debug version of the DLL (I make minor changes in the function in the DLL and when I call from the vb.net exe the result is correct.)
Thanks for your help ... !
MOPEKS - a freeware program that generates programs that use each other to solve problems. Is this the correct route to a genuinely intelligent machine?
Re: Debug a Native DLL written in VC++.NET 2010 Express called from a VB.NET .exe fil
Put your vb app and your vc dll into the same solution.
set the VB app as default
open the source for the VC dll
set the breakpoint where you want
'debug'
Re: Debug a Native DLL written in VC++.NET 2010 Express called from a VB.NET .exe fil
Originally Posted by OReubens
Put your vb app and your vc dll into the same solution.
Not sure how to do that ... I have already tried adding the vb.net exe file into the vc++.net source files. That did not work but maybe there are subtleties here ... ? I suspect the vb.net pdb file is needed ?
MOPEKS - a freeware program that generates programs that use each other to solve problems. Is this the correct route to a genuinely intelligent machine?
Re: Debug a Native DLL written in VC++.NET 2010 Express called from a VB.NET .exe fil
Originally Posted by wavering
The saga continues. Sometimes I think I must be the first person in the world to convert a VB6 project that calls a VC++ DLL into the new and exciting (ie really irritating) .net versions, namely vb.net and vc++.net
What new and exciting .net versions? Are you referring to the Visual Studio versions that came out 14 years ago?
At any rate, zip up the solution with the vb.net and dll projects and post it here. That way we can see how you organized your solution and don't have to guess or ask you 100 questions on how you've set things up.
Re: Debug a Native DLL written in VC++.NET 2010 Express called from a VB.NET .exe fil
Originally Posted by wavering
I don't understand ...
How do I do that? If you can answer that for VC++.net 2010 Express
I never use Express versions, so I would not help you with this. However, debugging DLL project did not change since at least VC++4 when I built my first DLL. You start Debug on DLL project, and IDE asks you about what exe to run. All you need is to provide the path to exe that loads your DLL.
Another approach is to run your exe out of IDE and attach debugger to the running process. I'm absolutely sure you can find detailed instructions in MS support knowledge base regarding DLL debugging.
Re: Debug a Native DLL written in VC++.NET 2010 Express called from a VB.NET .exe fil
Originally Posted by Igor Vartanov
I never use Express versions, so I would not help you with this. However, debugging DLL project did not change since at least VC++4 when I built my first DLL. You start Debug on DLL project, and IDE asks you about what exe to run.
MS says this has been DELIBERATELY removed in the Express versions. I can do this with VC++ 6.0 and have done so for years
Originally Posted by Igor Vartanov
Another approach is to run your exe out of IDE and attach debugger to the running process. I'm absolutely sure you can find detailed instructions in MS support knowledge base regarding DLL debugging.
That is what I have been trying to do for several days ... but thanks!
MOPEKS - a freeware program that generates programs that use each other to solve problems. Is this the correct route to a genuinely intelligent machine?
Re: Debug a Native DLL written in VC++.NET 2010 Express called from a VB.NET .exe fil
Originally Posted by wavering
MS says this has been DELIBERATELY removed in the Express versions.
How thoughtful of them.
Anyway, today I installed VS 2010 Express to one of my VMs. The sample project attached. First you build ConsoleApplication1 project (VB.NET exe), then you build test2010 project (VC++ DLL). In the latter you just press F5, and breakpoint hits in dlltest_w32.dll being loaded by ConsoleApplication1.exe.
The trick in dll project is done by Debugging settings: $(OutDir)ConsoleApplication1.exe, precisely as it was explained before.
There is another (C++) client in DLL solution. So, to some degree you may debug your DLL being driven by another client app alright.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.