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


Example of declaration for Fortran calling C

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

The following example shows a partial Fortran routine that calls a C function. The called C routine contains the #pragma linkage directive for the C function CFCN and the function definition for the C function.

Fortran Routine C Routine
INTEGER*4 INDEX
REAL*8 LIST(0:99)
REAL*8 VALUE
REAL*8 CFCN
⋮
VALUE=CFCN(INDEX, LIST)
 
#pragma linkage (cfcn, FORTRAN)
⋮
double cfcn(int *index, double list [])
{
⋮
}
 

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014