(j3.2006) TKR for C Interop

Aleksandar Donev donev1
Wed Feb 28 16:42:33 EST 2007

On Wednesday 28 February 2007 13:01, Bill Long wrote:

> Struct components either have documented names or not.? This is direction
> independent.?
OK, I was not aware of "small-group" decisions to change the API to a mixed 
struct/function approach (which is fine by me, modulo some details I complain 
about below).

For such an approach, the Fortran->C descriptor function should set the rank 
and type information to invalid values if they are not available (say 0 for 
rank and -1 for size of the element in bytes), or set them to valid values if 
they are available in the Fortran descriptor.

> The other functions create/destroy a shell C descriptor 
Why is this necessary? If we expect that the C descriptor will not match most 
vendors descriptors (and Craig can easily tell you this for several 
compilers), what is the point of making the C struct soo opaque? Let's allow 
the programmer to directly declare C descriptors without "creating" and 
"destroying" them. Some components of the C struct can still be opaque.

In C, structs are either of fixed size (this means rank-independent in our 
particular case), or they have flexible array members. I don't know of an 
in-between alternative. Which one of these two is this C struct you are 

BTW, C also has "incomplete types" which have unspecified size:

"The use of a type specifier of the syntactic classes 
<structure-type-reference> ... without a preceding definition...is alowed 
when the size of the structure is not required, including when declaring:
1. pointers to the structure
2. a typedef name as a synonym for the structure"

This is like a "handle" to a descriptor.

I see more open (and more fundamental) questions than just the triplets.

More information about the J3 mailing list