![](https://secure.gravatar.com/avatar/9820b5956634e5bbad7f4ed91a232822.jpg?s=120&d=mm&r=g)
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). David