I am trying to link existing, large Fortran code to python. I decided to utilize very good Python-C interoperability and link Fortran code with C wrapper first.
I have a proble with the following typedef:
type, BIND(C) :: type_state
complex*16, dimension (:,:,:,:),allocatable :: g
end type type_state
I have deleted the rest, as there are there a few integers and arrays. According to Intel Compiler manual, and Fortran 2003 specification, derived types may not contain pointer and allocatable arrays (but may fixed size arrays) to be interoperable with C struct contruct. Is there any way to go aroud the problem? Under some conditions this type should be mappable into "extern struct" with appriopriate number of pointers and integers inside it, but I suppose this is poorely portable.
The target machines are simple PCs with at most 2 modern Intel processors, working under linux (red hat, debian or Ubuntu).
lacek wrote:But it was included! C_PTR is defined by the standard as is C_F_POINTER and C_LOC. With these you can "convert" freely between C and Fortran pointers. This is all part of the C interoperability feature of Fortran 2003.
From You have written it seems that it is possible to use C_PTR as a middle step between "full Fortran" pointer and "C ponters in C Code".
The suggestion that you make seems very natural. Perhaps I do not understand it. It seems very natural, but it was not included in the standard. Why?