Sturla Molden wrote:
>> 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.

Thanks! (I'm rather new to Fortran...)

Ideally one should be able to point Cython to a Fortran library and 
start using it automatically. A good solution then seems to be to have 
Cython generate a Fortran 2003 wrapper around Fortran code (of any 
dialect), retyping the arguments as the ISO C types.

However one would still need some hint about which C types correspond to 
which Fortran types (in size, though they won't be the same type) to be 
able to generate such a wrapper automatically? Any ideas? (I suppose 
worst-case is that we can ship a configure script which generates an 
include-file with the right definitions)

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to