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


32-bit signed binary integer

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>
int cfort( int );
main()
{
  int x, y;
  x=5;
  y = cfort(x);
  printf
    ("Value returned to C: %d\n", y);
}
 
FUNCTION CFORT ( ARG )
INTEGER*4 CFORT
INTEGER*4 ARG
PRINT *, 'FORTRAN ARG VALUE:', ARG
CFORT = ARG
END
Sample C usage (by Reference) Fortran function
#pragma linkage (cfort,FORTRAN)
#include <stdio.h>
int cfort( int * );
main()
{
  int x, y;
  x=5;
  y = cfort(&x);
  printf
    ("Value returned to C: %d\n", y);
}
 
FUNCTION CFORT ( ARG )
INTEGER*4 CFORT
INTEGER*4 ARG
PRINT *, 'FORTRAN ARG VALUE:', ARG
CFORT = ARG
END

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014