Intel® Fortran Compiler 16.0 User and Reference Guide

C Structures, Typedefs, and Macros for Interoperability

The C structures CFI_dim_t and CFI_cdesc_t

CFI_dim_t is a typedef name for a C structure. It is used to represent lower bound, extent, and memory stride information for one dimension of an array. CFI_dim_t contains at least the following members in any order:

CFI_cdesc_t is a typedef name for a C structure, which contains a flexible array member. The first three members of the structure are base_addr, elem_len, and version in that order. The final member is dim. All other members must be between version and dim, in any order.

For a C descriptor of an array pointer or allocatable array, the value of the lower_bound member of each element of the dim member of the descriptor is determined by argument association, allocation, or pointer association. For a C descriptor of a nonallocatable nonpointer object, the value of the lower_bound member of each element of the dim member of the descriptor is zero.

In a C descriptor of an assumed-size array, the extent member of the last element of the dim member has the value -1. The value of elem_len for a Fortran CHARACTER object is equal to the character length times the number of bytes of a single character of that kind. If the kind is C_CHAR, this value will be equal to the character length.

Macros and typedefs in ISO_Fortran_binding.h

Except for CFI_CDESC_T, each macro defined in ISO_Fortran_binding.h expands to an integer constant expression that is either a single token or a parenthesized expression that is suitable for use in #if preprocessing directives.

CFI_CDESC_T is a function-like macro that takes one argument, which is the rank of the C descriptor to create, and evaluates to an unqualified type of suitable size and alignment for defining a variable to use as a C descriptor of that rank. The argument shall be an integer constant expression with a value that is greater than or equal to zero and less than or equal to CFI_MAX_RANK. A pointer to a variable declared using CFI_CDESC_T can be cast to CFI_cdesc_t *. A variable declared using CFI_CDESC_T must not have an initializer.

The CFI_CDESC_T macro provides the memory for a C descriptor. The address of an entity declared using the macro is not usable as an actual argument corresponding to a formal parameter of type CFI_cdesc_t * without an explicit cast.

CFI_index_t is a typedef name for a standard signed integer type capable of representing the result of subtracting two pointers.

The CFI_MAX_RANK macro has a value equal to the largest rank supported, i.e., 31. CFI_rank_t is a typedef name for a standard integer type capable of representing the largest supported rank.

The CFI_VERSION macro has a processor-dependent value that encodes the version of the ISO_Fortran_binding.h source file containing this macro. This value is increased if a new version of the source file is incompatible with the previous version.

CFI_attribute_t is a typedef name for a standard integer type capable of representing the values of the attribute codes.

CFI_type_t is a typedef name for a standard integer type capable of representing the values for the supported type specifiers.

The macros in the table below are for use as error codes. The macro CFI_SUCCESS is the integer constant 0. The value of each macro other than CFI_SUCCESS is nonzero and is different from the values of the other error code macros.

Macros for Error Codes

Macro name

Error condition

CFI_SUCCESS No error detected.
CFI_ERROR_BASE_ADDR_NULL The base address member of a C descriptor is a null pointer in a context that requires a non-null pointer value.
CFI_ERROR_BASE_ADDR_NOT_NULL The base address member of a C descriptor is not a null pointer in a context that requires a null pointer value.
CFI_INVALID_ELEM_LEN The value supplied for the element length member of a C descriptor is not valid.
CFI_INVALID_RANK The value supplied for the rank member of a C descriptor is not valid.
CFI_INVALID_TYPE The value supplied for the type member of a C descriptor is not valid.
CFI_INVALID_ATTRIBUTE The value supplied for the attribute member of a C descriptor is not valid.
CFI_INVALID_EXTENT The value supplied for the extent member of a CFI_dim_t structure is not valid.
CFI_INVALID_DESCRIPTOR A C descriptor is invalid in some way.
CFI_ERROR_MEM_ALLOCATION Memory allocation failed.
CFI_ERROR_OUT_OF_BOUNDS A reference is out of bounds.

See Also