Developer Guide and Reference

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

CFI_deallocate

C function prototype: Deallocates memory for an object described by a C descriptor.

int CFI_deallocate (CFI_cdesc_t *dv);

Formal Parameters:

dv

The address of a C descriptor describing the object. It must have been allocated using the same mechanism as the Fortran ALLOCATE statement. If the object is a pointer, it must be associated with a target satisfying the conditions for successful deallocation by the Fortran DEALLOCATE statement.

Description

Successful execution of CFI_deallocate deallocates memory for the object using the same mechanism as the Fortran DEALLOCATE statement, and the base_addr member of the C descriptor becomes a null pointer.

If an error is detected, the C descriptor is not modified.

Result Value

The result is an error indicator. A nonzero result indicates an error occurred; a zero result indicates successful execution.

Example

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

REAL, ALLOCATABLE :: A(:, :)

and the array is allocated, the following code deallocates it:

int ind;
ind = CFI_deallocate(dv);