Interoperability of procedures

A Fortran procedure is interoperable if its interface is interoperable. A Fortran procedure interface is interoperable if it has the BIND attribute. A Fortran procedure interface is interoperable with a C function prototype if:

In the following example, the Fortran procedure interface:

INTERFACE
   FUNCTION FUNC(I, J, K, L, M) BIND(C)
     USE, INTRINSIC :: ISO_C_BINDING
     INTEGER(C_SHORT) :: FUNC
     INTEGER(C_INT), VALUE :: I
     REAL(C_DOUBLE) :: J
     INTEGER(C_INT) :: K, L(10)
     TYPE(C_PTR), VALUE :: M
   END FUNCTION FUNC

END INTERFACE

is interoperable with the C function prototype:

short func(int i, double *j, int *k, int l[10], void *m);

A C data pointer may correspond to a Fortran dummy argument of type C_PTR or to a Fortran scalar that does not have the VALUE attribute. In the example, the C pointers j and k correspond to the Fortran scalars J and K, respectively. The C pointer m corresponds to the Fortran dummy argument M of type C_ PTR.