Calling C Programs From COBOL

ACUCOBOL-GT supports three methods of calling C programs from COBOL:

Wherever possible, we recommend that you package routines in a DLL or shared object library. This allows you to call the routines without having to relink the runtime. Note, however, that the method for packaging routines is platform specific.

Alternatively, the direct method and the interface method require that you link the external routines into the runtime. However, on Windows platforms, the interface method can be used with a DLL, in which case the runtime does not have to be relinked. See The "Sub" Interface.

All of these methods may be used in combination in the same program.

Note:

On UNIX and Linux systems, the runtime also attempts to resolve calls that are in its global symbol space. It does this by calling dlopen(NULL, ...) and adding the return value to the list of shared libraries to search. While not all functions are available, many are, including all of the standard C library functions (those in "libc.a" or "libc.so").

Note: To successfully interface to C routines, you need to analyze and implement appropriate data type matching and data exchange between COBOL and C programs.