Intel® Fortran Compiler XE 13.1 User and Reference Guides

Derived Types

For a derived type to be interoperable with C, you must specify the BIND attribute, as shown in the following:

type, BIND(C) :: MyType

Additionally, as shown in the examples that follow, each component must have an interoperable type and interoperable type parameters, must not be a pointer, and must not be allocatable. This allows Fortran and C types to correspond.

typedef struct {
int m, n;
float r;
} MyCtype

The above is interoperable with the following:

use, intrinsic :: ISO_C_BINDING
type, BIND(C) :: MyFtype
integer(C_INT) :: i, j
real(C_FLOAT) :: s
end type MyFtype

The following restrictions apply to a derived type specified with the BIND attribute:


Submit feedback on this help topic