Numeric Data Types
Normally, passing numeric data does not present a problem. The most important thing to keep in mind when passing numeric types is that in Win32, the C int type is 4 bytes, not 2 bytes, and therefore is equivalent to the Fortran INTEGER*4 type. The COMPLEX type is a special case and is discussed in a later section. The following table summarizes equivalent numeric data types for Fortran, MASM, and C/C++.
Equivalent Fortran, MASM, and C/C++ Numeric Data Types
Fortran | MASM | C/C++ |
CHARACTER*1 | BYTE | unsigned char |
INTEGER*1 | SBYTE | char |
(none) | WORD | unsigned short |
INTEGER*2 | SWORD | short |
(none) | DWORD | unsigned long, unsigned int |
INTEGER, INTEGER*4 | SDWORD | long, int |
REAL, REAL*4 | REAL4 | float |
DOUBLE PRECISION, REAL*8 | REAL8 | double |
If a C program passes an unsigned data type to a Fortran routine, the routine can accept the argument as the equivalent signed data type, but you should be careful that the range of the signed type is not exceeded.