To: J3 10-224r1
From: John Reid, Bill Long
Subject: Interop TR: Requirement 8b
Date: 2010 October 07
eferences: 10-165r2, ISO/IEC 1539-1:2010, N1820
DISCUSSION
Requirement 8b of N1820 is
A C function should have a mechanism to create an array that it can
use as an actual argument corresponding to an assumed-shape dummy of
a Fortran procedure. The same mechanism should allow an existing
block of memory in the C function, including an array passed into
the C function, or memory accessed as a global object, to be passed
to an assumed-shape dummy in Fortran.
This can be done by adding an extra function. It has been suggested
that there should be a similar function for pointers and allocatables,
so these is included. The functions use the types defined in
10-203r1.
EDITS to 10-165r2:
[12:7+] Add two new sections:
5.2.6.2a int CFI_allocatable ( CFI_cdesc_t * ,
const size_t elem_len,
const CFI_rank_t rank,
const CFI_type_t type );
<> CFI_allocatable changes a C descriptor to describe
an unallocated allocatable object with the element length, rank, and
type specified by the second and subsequent arguments.
5.2.6.2b int CFI_assumed_shape ( CFI_cdesc_t * ,
void * base_addr,
const size_t elem_len,
const CFI_rank_t rank,
const CFI_type_t type,
const CFI_bounds_t bounds[] );
<> CFI_assumed_shape changes a C descriptor to describe
an assumed-shape array with the element length, rank, type, bounds,
and strides specified by the third and subsequent arguments. If
base_addr has the value NULL, memory for the object is allocated by
malloc; otherwise, the base address of the object is base_addr.
[12:29+] Add new section:
5.2.6.7 int CFI_pointer ( CFI_cdesc_t * ,
void * base_addr,
const size_t elem_len,
const CFI_rank_t rank,
const CFI_type_t type,
const CFI_bounds_t bounds[] );
<> CFI_pointer changes a C descriptor to describe a
pointer object with the element length, rank, type, bounds, and
strides specified by the third and subsequent arguments. If base_addr
has the value NULL, memory for the object is allocated by malloc;
otherwise, the base address of the object is base_addr.