|
#include <string.h> #ifdef _CRAY # include <fortran.h> # define nameage NAMEAGE #else # ifndef _AIX # define nameage nameage_ # endif # define _fcd char * # define _cptofcd(a,b) (a) # define _fcdlen(a) strlen(a) #endif void nameage(_fcd name, int *nlen, int *age, float *temp); int main() { char *name = "Knut"; _fcd fp; int nlen,age = 4; float temp = 98.6; nlen = strlen(name); fp = _cptofcd(name, nlen); /* convert to Fortran string */ nameage(fp, &nlen, &age, &temp); return 0; }
SUBROUTINE NAMEAGE(NAME, NLEN, AGE, TEMP) CHARACTER*(*) NAME INTEGER NLEN,AGE REAL TEMP C WRITE(6,1000) NAME(1:NLEN),AGE,TEMP 1000 FORMAT(1X,'Hello ',A,', who is ',I2, . ' years old, has a temperature of ', f4.1) RETURN END
-V
option
(or equivalent) to get a verbose execution listing.
cf77 -c c2ffn.f
cc -c c2f.c
cf77 c2f.o c2ffn.o
xlf -c c2ffn.f
cc c2f.c c2ffn.o -lxlf90 -lxlf -lm
f77 -c c2ffn.f
gcc c2f.c c2ffn.o -lF77 -lm -lU77 -lI77 -lisam -lmpc -lc
f77 -c c2ffn.f
gcc c2f.c c2ffn.o -L/usr/lang/SC0.0 -lF77 -lm -lc
g77 -c c2ffn.f
gcc -c c2f.c
g77 c2f.o c2ffn.o