The Fortran FFI recognizes the following Fortran types:
•
INTEGER specifies a four-byte integer value. Sized integers can be specified with INTEGER*1, INTEGER*2, INTEGER*4, and INTEGER*8.
•
LOGICAL specifies a four-byte boolean value. Sized booleans can be specified with LOGICAL*1, LOGICAL*2, LOGICAL*4, and LOGICAL*8.
•
REAL specifies a single-precision floating-point real value.
•
DOUBLE-PRECISION specifies a double-precision floating-point real value. The alias REAL*8 is also recognized.
•
COMPLEX specifies a single-precision floating-point complex value.
•
DOUBLE-COMPLEX specifies a double-precision floating-point complex value. The alias COMPLEX*16 is also recognized.
•
CHARACTER(n) specifies a character string of length n. The Fortran 77 syntax CHARACTER*n is also recognized.
•
Fortran arrays can be specified by suffixing a comma-separated set of dimensions in parentheses, e.g. REAL(2,3,4). Arrays of unspecified length can be specified using * as a dimension. Arrays are passed in as flat Specialized arrays.
•
Struct classes defined by STRUCT: are also supported as parameter and return types.
When declaring the parameters of Fortran functions, an output argument can be specified by prefixing an exclamation point to the type name. This will cause the function word to leave the final value of the parameter on the stack.