Developer Guide and Reference

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

Handle Fortran Array Pointers and Allocatable Arrays

When a Standard Fortran array pointer or array is passed to another language, either its descriptor or its base address can be passed.

Standard Fortran array pointers and arrays are passed:

  • If the ATTRIBUTES properties are in effect.

  • If the INTERFACE of the procedure they are passed to is explicit.

If the INTERFACE declares the array pointer or array with deferred shape (for example, ARRAY(:)), its descriptor is passed. If the INTERFACE declares the array pointer or an array with fixed shape, or if there is no explicit interface, the base address passes it as a contiguous array. This process is similar to passing the first element of an array for contiguous array slices.

Use of the REFERENCE attribute on an array has no effect. Additionally, the VALUE attribute cannot be used with array arguments.

When you pass a Fortran array pointer or an array by descriptor to a non-Fortran routine, that routine needs to know how to interpret the descriptor. Part of the descriptor is a pointer to address space, such as a C pointer, and part of it is a description of the pointer or array properties, such as its rank, stride, and bounds.

For information about the Intel Fortran array descriptor format, see Handling Fortran Array Descriptors.

Standard Fortran array pointers and assumed-shape arrays are passed by passing the address of the array descriptor.

Standard Fortran pointers that point to scalar data contain the address of the data and are not passed by descriptor.