Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 6/24/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

CFI_address

C function prototype: Returns the C address of an object described by a C descriptor.

void *CFI_address (const CFI_cdesc_t *dv, 
                   const CFI_index_t subscripts[]);

Formal Parameters:

dv

The address of a C descriptor describing the object. The object must not be an unallocated allocatable variable or a pointer that is not associated.

subscripts

A null pointer or the address of an array of type CFI_index_t. If the object is an array, subscripts must be the address of an array of type CFI_index_t with at least n elements, where n is the rank of the object. The value of subscripts [i] must be within the bounds of dimension i specified by the dim member of the C descriptor.

Result Value

If the object is an array of rank n, the result is the C address of the element of the object that the first n elements of the subscripts argument would specify if used as subscripts. If the object is scalar, the result is its C address.

Example

If dv is the address of a C descriptor for the Fortran array A declared as follows:

REAL(C_FLOAT) :: A(100, 100)

then the following code calculates the C address of A(5, 10):

CFI_index_t subscripts[2];
float *address;
subscripts[0] = 4;
subscripts[1] = 9;
address = (float *) CFI_address(dv, subscripts );