Python and Fortran code

Alexander V. Voinov avv at quasar.ipa.nw.ru
Thu Jul 8 18:28:23 EDT 1999


Berthold Höllmann wrote:

> > Look at a combination of the SWIG tool (I can't remember where it's at but it
> > stands for Simplified Wrapper Interface Generator so you can search for it) and
> > a C wrapper for you fortran function. Basically, make it so you can call the
> > fortran from C. Then swig the C function and link the cstuff.o and fstuff.o with
> > cstuff_wrap.o (from SWIG) into a shared library then you can follow choice 2
> > from the other response to this post.
>
> For the Fortran wrapping you might take a look at cfortran.h avaible
> from http://www-zeus.desy.de/~burow/ which is helpfull if you want
> making the wrapping platform independent.

But if you are interested mainly in g77, you may take a look at a SWIG 'library'
fortran.i, found at:
 ftp://starship.python.net/pub/crew/avv/fortran_i-0.0.1.tgz
It's use is somewhat sophisticated, but for Fortran it does more than it would for C.
You may take a look at the example, supplied with the package to get an idea how to
use it and what would be the benefit.

Alexander






More information about the Python-list mailing list