z/OS Language Environment Writing Interlanguage Communication Applications
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Types of calls permitted

z/OS Language Environment Writing Interlanguage Communication Applications
SA38-0684-00

The following tables describe the types of calls that are supported between C and COBOL when running with Language Environment®.
  • Table 1 shows which calls are supported from COBOL programs to C routines that use #pragma linkage(...,COBOL).
  • Table 2 shows which calls are supported from COBOL programs to C routines that do not use #pragma linkage(...,COBOL).
  • Table 3 shows which calls are supported from C routines to COBOL programs.
Table 1. Support for calls from COBOL to C with #pragma linkage(...,COBOL)
Caller Call type Target
Non-reentrant C or naturally reentrant C Reentrant C that does not export functions or variables Reentrant C that exports functions or variables
VS COBOL II (1) static Yes Yes with restrictions (2) Yes with restrictions (2)
COBOL/370 (1) static Yes Yes Yes
COBOL (5) compiled with NODLL static Yes Yes Yes
VS COBOL II (1) dynamic Yes (3) Yes (3) No
COBOL/370 (1) dynamic Yes (3) Yes (3) No
COBOL (5) compiled with NODLL dynamic Yes (3) Yes (3) No
COBOL (6) compiled with DLL CALL "literal" to a function within the module Yes Yes Yes
COBOL (6) compiled with DLL CALL "literal" to a function exported from a DLL No No Yes (4)
COBOL (6) compiled with DLL CALL identifier to a function exported from a DLL No No Yes (4)
Note:
  1. When the caller is VS COBOL II or COBOL/370, all calls must be to void functions.
  2. Static calls are supported from VS COBOL II to reentrant C in the following cases:
    • The call is done in the main load module.
    • The call is done in a load module whose entry point is a Language Environment-conforming program or routine that was called using COBOL dynamic call.
    • The call is done in a load module whose entry point is not a Language Environment-conforming program or routine that was called using COBOL dynamic call, and there are no C routines in the main load module, and no reentrant C routines have been previously called in any other load module.
    • The call is done in a module that was called using C fetch.
  3. Dynamically called load modules cannot contain any DLL routines that export functions or variables.
  4. In this case, the C code can also be compiled with the XPLINK option. The XPLINK option implies the DLL option — all XPLINK compiled code is automatically DLL-enabled. The XPLINK C code must reside in a separate module from the COBOL caller.
  5. COBOL for MVS™ & VM, COBOL for OS/390® & VM, or Enterprise COBOL for z/OS.
  6. COBOL for OS/390 & VM or Enterprise COBOL for z/OS
Table 2. Support for calls from COBOL to C without #pragma linkage(...,COBOL)
Caller Call type Target
Non-reentrant C or naturally reentrant C Reentrant C that does not export functions or variables Reentrant C that exports functions or variables
VS COBOL II (1) static No No No
COBOL/370 (1) static No No No
COBOL (5) compiled with NODLL static Yes Yes with restrictions (2) Yes with restrictions (2)
VS COBOL II (1) dynamic No No No
COBOL/370 (1) dynamic No No No
COBOL (5) compiled with NODLL dynamic Yes (3) Yes (3) No
COBOL (6) compiled with DLL CALL "literal" to a function within the module Yes Yes Yes
COBOL (6) compiled with DLL CALL "literal" to a function exported from a DLL No No Yes (4)
COBOL (6) compiled with DLL CALL identifier to a function exported from a DLL No No Yes (4)
Note:
  1. For VS COBOL II or COBOL/370, #pragma linkage(...,COBOL) is required.
  2. Static calls are supported for calls from COBOL for MVS & VM, COBOL for OS/390 & VM, or Enterprise COBOL for z/OS compiled with NODLL to reentrant C that exports functions or variables in the following cases:
    • The call is done in the main load module.
    • The call is done in a DLL that was called using DLL linkage.
  3. Dynamically called load modules cannot contain any DLL routines that export functions or variables.
  4. In this case, the C code can also be compiled with the XPLINK option. The XPLINK option implies the DLL option — all XPLINK compiled code is automatically DLL-enabled. The XPLINK C code must reside in a separate module from the COBOL caller.
  5. COBOL for MVS & VM, COBOL for OS/390 & VM, or Enterprise COBOL for z/OS.
  6. COBOL for OS/390 & VM or Enterprise COBOL for z/OS
Table 3. Support for calls from C to COBOL
Caller Call type Target
VS COBOL II or COBOL/370 COBOL (3) compiled with NODLL COBOL (4) compiled with DLL
C with #pragma linkage(...,COBOL) and compiled with NODLL static Yes (1) Yes Yes
C without #pragma linkage(...,COBOL) and compiled with NODLL static No Yes Yes
C with #pragma linkage(...,COBOL) and compiled with NODLL fetch Yes (1, 2) Yes (2) No
C without #pragma linkage(...,COBOL) and compiled with NODLL fetch No Yes (2) No
C with #pragma linkage(...,COBOL) and compiled with DLL static Yes (1) Yes Yes
C without #pragma linkage(...,COBOL) and compiled with DLL static No Yes Yes
C with #pragma linkage(...,COBOL) and compiled DLL fetch Yes (1,2) Yes (2) No
C without #pragma linkage(...,COBOL) and compiled DLL fetch No Yes (2) No
C with #pragma linkage(...,COBOL) and compiled DLL dynamic (called function is exported from a DLL) No No Yes
C without #pragma linkage(...,COBOL) and compiled with DLL dynamic (called function is exported from a DLL) No No Yes
C with #pragma linkage(...,COBOL) and compiled with XPLINK static No No No
C without #pragma linkage(...,COBOL) and compiled with XPLINK static No No No
C with #pragma linkage(...,COBOL) and compiled with XPLINK fetch No Yes (2) No
C without #pragma linkage(...,COBOL) and compiled with XPLINK fetch No Yes (2) No
C with #pragma linkage(...,COBOL) and compiled with XPLINK dynamic (called function is exported from a DLL) No No Yes
C without #pragma linkage(...,COBOL) and compiled with XPLINK dynamic (called function is exported from a DLL) No No Yes
Note:
  1. When the target of the call is VS COBOL II or COBOL/370, the called COBOL program must be declared as a void function.
  2. Fetched COBOL load modules cannot contain any DLL routines that export functions or variables.
  3. COBOL for MVS & VM, COBOL for OS/390 & VM, or Enterprise COBOL for z/OS.
  4. COBOL for OS/390 & VM or Enterprise COBOL for z/OS.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014