[Cython] Fortran types in C
Sturla Molden
sturla at molden.no
Mon Feb 23 05:37:36 CET 2009
>What is the best way of declaring Fortran types in C? I understand there
>is likely no perfect cross-platform solution here
ISO Fortran 2003 has standard bindings to ISO C. Most Fortran compilers
support them, including gfortran. These C bindings make C callable from
Fortran, but they also make Fortran callable from C in a standardized and
portable way.
The short receipe is: you don't declare any Fortran types in C. You
declare your Fortran functions with C types. This even includes
pass-by-value calling convention. Then the Fortran compiler will do the
correct conversion.
>Furthermore it would be very sweet to
>automatically be able to pass Python buffer objects as F90 assumed-shape
>arrays :-)
Take a look at the array-descriptor library of Chasm.
http://chasm-interop.sourceforge.net/
Regards,
Sturla Molden
More information about the Cython-dev
mailing list