For simple data types (not COMPLEX or CHARACTER strings), define or pass each associated argument in the C routine as a pointer:.
Table 11-4 Passing Simple Data Types
Fortran calls C |
C calls Fortran |
---|---|
integer i real r external CSim i = 100 call CSim(i,r) ... ---------------------------- void csim_(int *i, float *r) { *r = *i; }
|
int i=100; float r; extern void fsim_(int *i, float *r); fsim_(&i, &r); ... ------------------------------ subroutine FSim(i,r) integer i real r r = i return end |