Integrating Python with Fortran

Robert Kern robert.kern at gmail.com
Wed Nov 1 00:46:06 EST 2006


unexpected wrote:
> Hi all,
> 
> I'm currently working on a large, legacy Fortran application. I would
> like to start new development in Python (as it is mainly I/O related).
> In order to do so, however, the whole project needs to be able to
> compile in Fortran.
> 
> I'm aware of resources like the F2Py Interface generator, but this only
> lets me access the Fortran modules I need in Python. I'm wondering if
> there's a way to generate the .o files from Python (maybe using
> py2exe?) and then link the .o file with the rest of the Fortran project
> using something like gcc.

There are no tools specifically for embedded Python in Fortran. However, there 
is Elmer, which helps to create a C API for a Python library (essentially the 
inverse of SWIG). One can then wrap that C API with a Fortran-compliant 
interface in the fairly standard ways.

   http://elmer.sourceforge.net/

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list