Even when you have reconciled calling conventions, naming conventions, and methods of data exchange, you must still be concerned with data types, because each language handles them differently.
The following table lists the equivalent data types between Fortran and C:
Fortran Data Type |
C Data Type |
---|---|
INTEGER(1) |
char |
INTEGER(2) |
short |
INTEGER(4) |
int, long |
INTEGER(8) |
_int64 |
REAL(4) |
float |
REAL(8) |
double |
REAL(16) |
--- |
CHARACTER(1) |
unsigned char |
CHARACTER*(*) |
|
COMPLEX(4) |
struct complex4 { |
COMPLEX(8) |
struct complex8 { |
COMPLEX(16) |
--- |
All LOGICAL types |
Use integer types for C |
See these topics:
Handling Numeric, Complex, and Logical Data Types
Handling Fortran Array Pointers and Allocatable Arrays
Handling Intel Fortran Pointers