[SciPy-dev] Combining Numpy/C/fortran ?

John Pye john@curioussymbols....
Fri Mar 9 17:41:42 CST 2007

If you find difficulty in getting setup.py to do what you want, then try
SCons (http://www.scons.org). It is python based, and supports linking
fortran, SWIG, C, C++, (and lots of other types of code) very naturally.

If you want to provide python access directly to a fortran function, the
approach with SWIG would be to write a *C header file* that described
the fortran function, then embed the header file in your SWIG .i file.
Then something like the following should just work:

env.SharedLibrary('_mymodule.so', ['myswig.i','myfortran.f'])

This might be possible with setup.py; I'm not sure.


Pierre GM wrote:
> On Friday 09 March 2007 06:44:43 John Pye wrote:
>> Maybe this is what you're looking for?
>> http://www.scipy.org/Cookbook/SWIG_and_NumPy
> Almost. I guess that should do the trick as long as I stay on the C side. 
> However, how should I write the setup.py so that the required fortran files 
> are compiled properly ? I haven't been able to find any example...
> And as I'm mixing C and fortran, I have to declare the arrays with 
> an "order='F'", right ?
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev

More information about the Scipy-dev mailing list