Calling between COBOL and C/C++ programs

You can call functions written in C/C++ from COBOL programs and can call COBOL programs from C/C++ functions.

In an interlanguage application, you can combine 64-bit COBOL programs with 64-bit C/C++ functions, or 32-bit COBOL programs with 32-bit C/C++ functions.

  • You cannot mix 32-bit components and 64-bit components in an application.
  • The ADDR(64) and -q64 options are not currently supported. Only 32-bit COBOL programs can be created at this time.
Interlanguage communication between COBOL and C++: In an interlanguage application that mixes COBOL and C++, follow these guidelines:
  • Specify extern "C" in function prototypes for COBOL programs that are called from C++, and in C++ functions that are called from COBOL.
  • In COBOL, use BY VALUE parameters to match the normal C++ parameter convention.
  • In C++, use reference parameters to match the COBOL BY REFERENCE convention.

The rules and guidelines referenced below provide further information about how to perform these interlanguage calls.

Unqualified references to "C/C++" in the referenced sections are to GNU GCC compiler.

Related references      
COBOL and C/C++ data types