Example of declaration for Fortran calling C

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 [])
{
⋮
}