https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90352
--- Comment #6 from Paul Thomas <pault at gcc dot gnu.org> --- (In reply to Thomas Koenig from comment #5) > Hi Paul, > > > I am sure that the array part is OK. Otherwise, why have a type code for > > strings? > > It > > 18.5 The source file ISO_Fortran_binding.h > 18.5.1 Summary of contents > > The source file ISO_Fortran_binding.h shall contain the C structure > definitions, typedef declarations, macro > definitions, and function prototypes specified in 18.5.2 to 18.5.5. The > definitions and declarations in ISO_- > Fortran_binding.h can be used by a C function to interpret and manipulate a > C descriptor. These provide a > means to specify a C prototype that interoperates with a Fortran interface > that has a non-interoperable dummy > variable (18.3.6). > > And the length of the character should be passed as element_len in > the various CFI_* functions. > > > I guess scalars can be handled by passing to an assumed rank array. > > An array of character*1 is interoperable, yes. > > Regards > > Thomas Concerning CFI descriptors: NOTE 18.24 The value of elem_len for a Fortran CHARACTER object is equal to the character length times the number of bytes of a single character of that kind. If the kind is C_CHAR, this value will be equal to the character length. This what I have implemented. I have been trying and so far failing to pick up substrings directly as CFI descriptors rather than using copy-in and copy out. For some reason the saved descriptor is inaccessible. I will investigate a wee while longer before committing. What I have works and clears all the problems, except for the missing optional issue - I'll sort out the latter before submission. Cheers Paul Cheers Paul