On Jan 16, 2009, at 1:36 AM, Dag Sverre Seljebotn wrote:

> As I have to interface a lot with some Fortran code these days, and a
> full-fledged Cython<->Fortran-binding *may* come out of it (if I
> continue to manage using Cython for this task it would be a likely
> result in about a year, at least I structure my hacky scripts in that
> direction),

I know virtually nothing about Fortran, but this sure sounds cool and  
I'm sure the number-crunching communities would really like it.

> I feel free to ask a somewhat tangential question:
>
> What is the best way of declaring Fortran types in C? I understand  
> there
> is likely no perfect cross-platform solution here, but is the naive
> approach taken by f2py (C int == integer(4) == default Fortran  
> integer)
> sufficient? Including libgfortran.h or similar is too compiler  
> dependant
> and complicated (but I'd be willing to use a single header file with
> ifdefs for platforms and compilers, if anyone have such a thing...)
>
> Looking to a Cython binding, I think there would be a seperate type
> hierarchy for Fortran types ("cython.fortran.real8" etc.), using  
> Fortran
> specific typedefs in C. Furthermore it would be very sweet to
> automatically be able to pass Python buffer objects as F90 assumed- 
> shape
> arrays :-) (I think a Fortran wrapper module would then have to be
> generated, as there's no consistent ABI for those. The same goes for
> strings.).

I would follow whatever conventions are followed for C-Fortran  
interfaces, if that makes any sense.

- Robert

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

Reply via email to