sharing variables in fortran

Travis Oliphant olipt at mayo.edu
Tue Apr 27 03:45:58 EDT 1999


> I am wondering if it is possible to coerce python to use
> memory  addresses corresponding to a fortran common block (by way of a c
> extension)
> for storage of certain variables.

Yes, but you won't find a ton of information about it.  Be prepared to
experiment a little.

I would suggest using the Numeric module with it's C-API.

There is an exported function you can call from C called 
PyArray_FromDimsAndData that creates a NumPy array from some dimension
information and a pointer to already allocated memory.  There is some
improving documentation on the C-API to Numeric in the documentation
recently released for NumPy.  See the scientific computing topic section
of www.python.org

I'm not sure how to access a Fortran common block from C at the moment.

Have you heard about the PyOpenGL interface?

Good luck.

Travis








More information about the Python-list mailing list