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

ID 767251
Date 9/08/2022
Public

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

Document Table of Contents

CFI_setpointer

C function prototype: Updates a C descriptor for a Fortran pointer to be associated with the whole of a given object or to be disassociated.

int CFI_setpointer(CFI_cdesc_t *result, CFI_cdesc_t *source,
                   const CFI_index_t lower_bounds[]);

Formal Parameters:

result

The address of a C descriptor for a Fortran pointer. It is updated using information from the source and lower_bounds arguments.

source

A null pointer or the address of a C descriptor for a nonallocatable nonpointer data object, an allocated allocatable object, or a data pointer object. If source is not a null pointer, the corresponding values of the elem_len, rank, and type members must be the same in the C descriptors with the addresses source and result.

lower_bounds

If source is not a null pointer and source->rank is nonzero, lower_bounds must be a null pointer or the address of an array with at least source->rank elements.

Description

Successful execution of CFI_setpointer updates the base_addr and dim members of the C descriptor with the address result as follows:

  • If source is a null pointer or the address of a C descriptor for a disassociated pointer, the updated C descriptor describes a disassociated pointer.

  • Otherwise, the C descriptor with the address result becomes a C descriptor for the object described by the C descriptor with the address source, except that if source->rank is nonzero and lower_bounds is not a null pointer, the lower bounds are replaced by the values of the first source->rank elements of the lower_bounds array.

Result Value

The result is an error indicator.

Example

If ptr is already the address of a C descriptor for an array pointer of rank 1, the following code updates it to be a C descriptor for a pointer to the same array with lower bound 0:

CFI_index_t lower_bounds[1];
int ind;
lower_bounds[0] = 0;
ind = CFI_setpointer(ptr, ptr, lower_bounds);