[MATRIX-SIG] Python/Fortran interface

Konrad Hinsen hinsen@ibs.ibs.fr
Sat, 16 Aug 1997 11:45:12 +0200

> A couple of messages over the past two days have indicated
> that there is some interest in calling Fortran from Python.
> A project that I am working on will require this ability for its
> success. I would appreciate any info that this group might have
> that relates to creating  such an interface .  Apparently

There is no problem at all in calling Fortran from Python; in fact, it
requires no more than the ability to call Fortran from C, since Python
is written in C. The point of FIDL (as I understand it) was to
automatize interface generation in a similar way as SWIG does for C.
That is certainly important to deal with a large number of routines,
but if you need just a few, manual wrapping should pose no major
problems. To simplify C-Fortran interfacing, you could use the
CFORTRAN package developed at DESY.

I am using the Fortran version of LAPACK with the NumPy module
LinearAlgebra, and I have also called a few of my own Fortran
subroutines from Python, so it is definitely possible. Depending on
your platform, it could be tricky to put Fortran code into a dynamic
library due to library problems (and lack of documentation), but
I don't see any problem for static linking.

Konrad Hinsen                          | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire   | Tel.: +33-
Institut de Biologie Structurale       | Fax:  +33-
41, av. des Martyrs                    | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France         | Nederlands/Francais

MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org