Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

Variables

A scalar Fortran variable is interoperable if its type and type parameters are interoperable, and if it is not a pointer.

An array Fortran variable is interoperable if its type and type parameters are interoperable, and it has an explicit shape or assumed size. It interoperates with a C array of the same type, type parameters, and shape, but with subscripts reversed.

For example, a Fortran array declared as integer :: a(18, 3:7, *) is interoperable with a C array declared as int b[][5][18].

Scalar variables are interoperable only if the type parameters (kind and length) are interoperable, not a coarray, do not have the POINTER or ALLOCATABLE attribute, and if character length is not assumed nor defined by a non-constant expression.

Arrays are interoperable if the base type meets the scalar variable requirements, if they are explicit shape or assumed-size, and are not zero-sized. Assumed-size arrays are interoperable only with C arrays that have no size specified. An allocatable array, coarray, or array pointer is not interoperable.