Using COBOL DLLs with C/C++ programs
COBOL support for DLLs interoperates with the DLL support
in the z/OS® C/C++ products, except for COBOL
In particular, COBOL applications can call functions that are exported
from C/C++ DLLs, and C/C++ applications can call COBOL
programs that are exported from COBOL DLLs.
COBOL data items that are declared with the
are independent of DLL support. These data items are accessible by
name from any COBOL program in the run unit that declares them, regardless
of whether the programs are in DLLs.
The COBOL options
EXPORTALL work much the same way as the C/C++
EXPORTALL options. (The
applies only to C.) However, the C/C++ compiler
produces DLL-enabled code by default.
You can pass a C/C++ DLL function pointer to COBOL and use it within COBOL, receiving the C/C++ function pointer as a function-pointer data item. The following example shows a COBOL call to a C function that returns a function pointer to a service, followed by a COBOL call to the service.
01 fp usage function-pointer.
Call "c-function" returning fp.