- When using COBOL and C object code together, Micro Focus recommends you build and keep the COBOL and C executables separate,
and use import libraries and the Micro Focus C functions for calling COBOL (see "C functions for calling COBOL" in the product
help) to resolve calls between them.
Calling a COBOL entry point directly
Note: The following instructions are required on little-endian PowerLinux platforms, but should also be considered good programming
practice on other platforms. References to COBOL entry points in this topic include both the PROCEDURE DIVISION header and
When calling a COBOL entry point directly from C (as opposed to using
cobfunc()), and passing fewer parameters than are specified on the entry point (that is, fewer actual parameters than formal parameters)
then the COBOL entry point called from C should either:
- Not be declared in the C program with a function prototype; or
- Be declared in the C program with a function prototype with a variadic parameter list (see below).
Take a COBOL program with the following entry points defined:
entry "bob" using arg1 arg2 arg3 arg4 arg5 arg6
arg7 arg8 arg9.
and a C program that contains code such as:
i = bob(&x1, &x2);
then the correct way to declare this COBOL entry point in the C program is as follows:
int bob(void *arg1, void *arg2,...);