Problem:
This program demonstrates how to create a Windows 32-bit .DLL from a COBOL program which can be called by a Microsoft Visual C program.
Resolution:
The .DLL will be loaded by the C executable CALLER.EXE. The entry points will be made public and then GETSTR1 will be called to get the first string to display and GETSTR2 will be called to get the second string to display. Both of these strings will then be output in the Window which is created and maintained by CALLER.EXE.
This program was tested using Microsoft Visual C/C V6.0.
SOURCE FILES:
==========
Program Files
Description
--------------------- ---------------------------------------------------------
WINDLL.CBL Program which is built into WINDLL.DLL and is called by CALLER.EXE
WINDLL.DEF Definitions file created by the Net Express build.
CALLER.C C source program which is built into CALLER.EXE and calls WINDLL.DLL.
CALLER.DSW Visual C Project Workspace file.
CALLER.DSP Visual C Project File.
CALLER.* Visual C support files for debugging.
REQUIREMENTS:
==========
This sample requires that you have the Microsoft Visual C/C V6.0 or Visual Studio product installed on your system.
OPERATION:
========
Rebuild the project C-CALL-COB to create the WINDLL.DLL file in the DEBUG subdirectory. This is where the C program will expect to find it.
Prior to running this .DLL you also need to rebuild the CALLER.EXE program. To do this you must do the following:
1. Start Microsoft Visual C/C .
2. Select Open Work Space from the File menu.
3. Open the Workspace file CALLER.DSW in the project directory.
4. Select Rebuild All from the Rebuild menu. This will create CALLER.EXE in the DEBUG subdirectory of your project.
5. To run the program Select either the Execute or the Start Debugger option from the Build menu.
6. If you wish to step through the calls to COBOL place a break-point on the following source lines:
StrProc = GetProcAddress (hlib, "GETSTR1") ;
(*StrProc) (szText) ;
and
StrProc = GetProcAddress (hlib, "GETSTR1") ;
(*StrProc) (szText) ;
NOTE:
====
If you wish to invoke the Animator to debug the COBOL .DLL then you should remove the comments on the lines containing a CALL "CBL_DEBUGBREAK" statement.
==========================================================
Keywords: Example, sample, demo, demonstration, mixed language, c-call-cobol.zip
demo.ex
demo.ne