Skip to main content

Problem:

How exactly do you setup Net Express and Visual Studio 6.0 to debug a Visual C/C 6.0 DLL from within Net Express? Cobol is calling the 'C' DLL.

This is one of those situations where you must accept Microsoft Win32 limitations and adopt an  approach that is less intuitive.

Under Microsoft Win32, only one debugger can be running at any time.

You need both the Net Express development system and the Visual Studio system installed on the same machine.

You need to make certain the Dynamic checkbox is checked in your Build Settings for your COBOL program(s).

Merge your COBOL project into the 'C' project directory structure where the 'C' DLL project is located. Both directory structures have a Debug directory. Your COBOL application file (*.APP) and your COBOL source files are in the same directory as the 'C' source programs and workspace files. The Debug directory should be subordinate to this project directory.

Resolution:

1) Start Visual Studio and open your 'C' DLL project.

2) In Visual Studio start debugging with your COBOL program. Visual Studio won't actually debug your COBOL program, but it will run it. When the COBOL program calls an entry point in your DLL, Visual Studio will show you the source for your 'C/C ' program.

If you want to debug both the 'C' and the COBOL, you will need to adjust your COBOL so that the Net Express Animator can animate an .Int version of your COBOL program. You will need a procedure-pointer item and a set ... to entry statement to get the 'C' DLL loaded before you actually make a call to the DLL's entry point. The project and debug directories for the COBOL project will need to be merged with the 'C' project directories.

In this scenario, start Visual Studio and open the 'C' DLL project. Then use Visual Studio and begin debugging with the Net Express (Mfnetx.exe) development system. You'll need to prefix Mfnetx.exe with a drive and path to where the executable is actually located because you want  Net Express to start execution within the Visual Studio project directory.

Use Net Express (started by Visual Studio) to open the Net Express project, edit the COBOL source and start the Animation of the .Int version of your program. You must have your TaskBar visible as you will need to monitor exactly what you have showing and you may need to use the button for either of the debuggers to get things into focus.

The reason this works is that although Visual Studio is a debugger, Animator, when animating .Int code, is an interpreter, not a debugger.

When using the two systems in this manner expect the worst. If either system or application program crashes, the other system and program is going to be left high and dry. Inconsistent error messages are the norm under these circumstances and you should  expect that you will need to shut everything down and reboot.

Old KB# 6905