types in g95
Paul Brook
paul@nowt.org
Mon Oct 27 21:53:00 GMT 2003
On Monday 27 October 2003 12:57 pm, Lars Segerlund wrote:
> Hi,
>
> Since I am looking at the intrinsic modules and C API i have been
> looking through the handling of types i gfortran, what I have found is
> that we have a set of backend type nodes which for now is mapped to the C
> types, however if I am not mistaken I have to create a set explicitly
> mapped to the C types, ( set of backend nodes ), in order to provide the
> correct mapping to C types.
>
> Does this sound reasonable or am I barking up the wrong tree ?
I don't think this is neccessary. AFAICS all you need to do is provide
constants that specify which types kinds relate to which C types. Our
existing kinds should be sufficient to implement the required
functionality. If not we should add extra fortran kinds rather than
creating extra backend nodes.
i.e. on i386-linux we would just provide the equivalent of
module ISO_C_BINDING
integer, parameter :: C_SHORT = 2, C_INT = 4, C_LONG = 4
integer, parameter :: C_FLOAT = 4, C_DOUBLE = 8, C_LONG_DOUBLE = -4
integer, parameter :: C_CHAR = 1
end module
The C_PTR type should probably be implemented by making it an alias for the
appropriate integer type. It may be easiest to keep it as a seperate type
until we start generating backend trees.
Paul
More information about the Fortran
mailing list