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, Visual Basic, and MASM:
Fortran Data Type | C Data Type | Visual Basic Data Type | MASM Data Type |
---|---|---|---|
INTEGER(1) | char | --- | SBYTE |
INTEGER(2) | short | Integer | SWORD |
INTEGER(4) | int, long | Long | SDWORD |
INTEGER(8) | _int64 | --- | QWORD |
REAL(4) | float | Single | REAL4 |
REAL(8) | double | Double | REAL8 |
CHARACTER(1) | unsigned char | --- | BYTE |
CHARACTER*(*) | See Handling Character Strings | ||
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 |
All LOGICAL types | Use integer types for C, MASM, and Visual Basic |
The following sections describe how to reconcile data types between the different languages: