[SciPy-user] Is it possible to pass Fortran derived data types to Python via C and SWIG?
Sun Nov 30 02:49:09 CST 2008
John Salvatier wrote:
> I have a Fortran 90 algorithm which uses a derived data type to return
> data, and I would like to make a python wrapper for this algorithm. I
> understand that f2py cannot wrap derived data types; is it possible to
> do so with a C interface for the Fortran algorithm and SWIG? I would
> have to pass the derived data type into a C struct and then to Python.
It is possible as long as you can pass the structure from fortran to C.
I don't know anything about Fortran derived data types, but if it is a
non trivial object (more than a set of fundamental types), I am afraid
it will be difficult. Does F90 supports POD data ? Otherwise, you will
need a scheme for marshalling your data from Fortran to C (to match
exactly how the structure would look like in C at the binary level).
More information about the SciPy-user