Python/Fortran interoperability

sturlamolden sturlamolden at yahoo.no
Mon Aug 24 15:14:26 EDT 2009


On 24 Aug, 20:55, n... at cam.ac.uk wrote:

> Precisely.  And the kludge does NOT work under all circumstances,
> which is why I said that it doesn't work very well.

Do you have an example?


> Consider, for example:
>
>     SUBROUTINE Fred (X) BIND(C)
>     CHARACTER*(*) :: X
>     END SUBROUTINE Fred


Obviously that is not allowed, because C does not know anything about
Fortran strings. How should a C compiler pass the correct data
structure to Fred?

The C bindings in Fortran 2003 has functions to convert C pointers to
Fortran pointers (c_f_pointer, c_f_procpointer), because C does not
know the ABI of a particular Fortran implementation.







More information about the Python-list mailing list