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 among Fortran, C, and MASM:
Fortran Data Type |
C Data Type |
MASM Data Type |
---|---|---|
REAL(4) |
float |
REAL4 |
REAL(8) |
double |
REAL8 |
REAL(16) |
--- |
--- |
CHARACTER(1) |
unsigned char |
BYTE |
CHARACTER*(*) |
||
COMPLEX(4) |
struct complex4 { float real, imag; }; |
COMPLEX4 STRUCT 4 real REAL4 0 imag REAL4 0 COMPLEX4 ENDS |
COMPLEX(8) |
struct complex8 { double real, imag; }; |
COMPLEX8 STRUCT 8 real REAL8 0 imag REAL8 0 COMPLEX8 ENDS |
COMPLEX(16) |
--- |
--- |
All LOGICAL types |
Use integer types for C, MASM |
|
INTEGER(1) |
char |
.sbyte |
INTEGER(2) |
short |
.sword |
INTEGER(4) |
int |
.sdword |
INTEGER(8) |
_int64 |
.qword |
The following sections describe how to reconcile data types between the different languages: