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


Long floating-point number

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

Sample C usage (by Value) Fortran function
#pragma linkage (cfort,FORTRAN)
#include <stdio.h>
double cfort(double);
main()
{
  double x, y;
  x=12.5;
  y=cfort(x);
  printf
    ("Value returned to C: %f\n", y);
}

 
FUNCTION CFORT ( ARG )
REAL*8 CFORT
REAL*8 ARG
PRINT *, 'FORTRAN ARG VALUE:', ARG
CFORT = ARG
END
Sample C usage (by Reference) Fortran function
#pragma linkage (cfort,FORTRAN)
#include <stdio.h>
double cfort(double *);
main()
{
  double x, y;
  x=12.5;
  y=cfort(&x);
  printf
    ("Value returned to C: %f\n", y);
}
FUNCTION CFORT ( ARG )
REAL*8 CFORT
REAL*8 ARG
PRINT *, 'FORTRAN ARG VALUE:', ARG
CFORT = ARG
END

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014