Newbie
Newbie

Reputation: 167

How to debug VC++ dll in VB6

I tried a few different ways, but none of them works.

Method 1 I tried:

Start the VB program and run until before the DLL runs. Open VC++ (no project) and select Build | Start Debug | Attach to Process Attach to the VB program Open the DLL source code file in VC++, select a breakpoint in the code. Continue running the VB program, and it didn't jump to the VC++.

Method 2 I tried:

"After a long struggle found the answer for this. Actually we have to give the path of VB6.exe in the Projects->settings->debug->category->general->Executable for debug session.Then when you try to debug the VC++ dll by having a breakpoint in the function that needs to be checked,a new VB6 IDE would be opened.There please select the VB6 Dll project that actually calls the VC++6 dll. run that application and when the function call to the VC++6 comes in the VB6 function, automatically the control goes to the VC++ IDE and you can debug it as usua" From MSDN---->It just went to the next line of code in VB application, didn't go to the VC++ IDE like method 1.

The VB application declares dll file like this:

 dim query as object
 query=CreateObject("ClientServer.getResultClass")

 query.execute(parameter1,parameter2)

I'm not sure if I need to put the debug dll into a specific place or I may need to register the debug dll file (I checked gedit, the ClientServer.getResultClass is registered).

Upvotes: 0

Views: 1206

Answers (1)

Owen Wengerd
Owen Wengerd

Reputation: 1628

You're on the right track with Method 1. You need to make sure you attach the 'Native' debugger, and that the DLL includes debug info, and that the source code matches the DLL. If all three conditions are met, it should work. Note that it's almost always necessary to use a freshly built DLL to ensure that the third condition is met.

Upvotes: 0

Related Questions