Passing data between C and COBOL with #pragma

Note:

The reference to COBOL with #pragma applies to VS COBOL II, COBOL/370, COBOL for MVS & VM, COBOL for OS/390 & VM, and Enterprise COBOL for z/OS.

When data is passed between C and COBOL with #pragma linkage (COBOL), the C compiler generates the appropriate addressing code which introduces an extra level of indirection on the C side for non-pointer types. Pointers, however, are passed directly, meaning that for COBOL to receive a pointer to a C data type, C must pass a pointer to a pointer to the C data type. Conversely, if COBOL returns a pointer to a data type, C receives a pointer to a pointer to the data type.