This COBOL system provides a number of library functions that enable you to mix C and COBOL programs. These functions are intended primarily for use in C programs.
The functions are prototyped in C header files, which are located in %ProgramFiles(x86)%\Micro Focus\Visual COBOL\include by default.
The functions use portable data types, which have the naming convention cobtype_t. Definitions of these data types can be found in the cobtypes.h header file located in %ProgramFiles(x86)%\Micro Focus\Visual COBOL\include by default.
A C function can call a COBOL entry point in the same way as it would call another C function. For example, the following demonstrates C code that calls a COBOL entry point, cobep, using two arguments:
A C function can call, and cancel, COBOL programs and entry points using the cobcall(), cobcancel() and cobfunc() routines, as described in the C Functions for Calling COBOL section.
Before calling a COBOL program, you must call cobinit(). In a threaded environment where you don't know if you're the first thread or not, each thread should call cobinit().
Before exiting a thread that has called a COBOL program, but which was not created via COBOL multi-threading syntax or library routines, you must call cobthreadtidy().
Before exiting an application that has called a COBOL program you must call either cobtidy() or cobexit().
If the COBOL program and the C function that calls it are not contained in a callable DLL/shared object, nor linked together in a system executable file, then:
All the C routines for calling COBOL are described in reference topics.