Newbie: Can python be embedded in a fortran program?

kern at caltech.edu kern at caltech.edu
Sat Aug 12 15:46:30 EDT 2000


On Sat, 12 Aug 2000 19:31:21 +0200, "Ranjeet Utikar"
<r.p.utikar at ct.utwente.nl> wrote:

>Hi,
>
>There is some documentation (and also a lot of threads on this newsgroup) on
>embedding python in a c program. I would like to embed it in a fortran
>program so that the gui, input, error checking is done by python and core
>computations are done in fortran. does anybody have any idea on doing this?
>where can i find pointers for the same? I have access to Compaq visual
>fortran 6.1.

In this case, you might want to extend the interpreter with extension
modules written in C that call the FORTRAN routines, rather than embed
the interpreter into your program.  It depends on how well you can
separate the computation routines from the rest of the program that
has already been written.

To assist you, there are the following tools:

Numerical Python:
http://numpy.sourceforge.net

Pyfort:
http://pyfortran.sourceforge.net

f2py:
http://koer.ioc.ee/projects/f2py2e/

The last two depend on Numerical Python.

>TIA
>Ranjeet

--
Robert Kern
kern at caltech.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter



More information about the Python-list mailing list