f2py release 5 coming soon (was Re: [f2py] Wrapping simple Fortran
routine on Windows using VisualStudio)
Pearu Peterson
pearu@cens.ioc.ee
Fri, 4 Jan 2002 16:14:16 +0200 (EET)
Hi!
On Fri, 4 Jan 2002, Herb Schilling wrote:
> Your release notes for the Release 4 mention that a couple of folks
> helped with making f2py work on Windows. Do you have any complete
> examples of how that works? I am looking for Makefiles, wrapper code,
> signature files,.... I am definitely thinking of trying cygwin again.
I am working on the next f2py release 5 that uses scipy_distutils for
building extension modules, not Makefiles any more. I have made the
corresponding snapshot available to f2py home page.
Eric Jones wrote a small HOWTO for win32, see
http://www.scipy.org/Members/eric/f2py_win32
It is a bit out of date and incomplete, but should be useful for getting
started.
When you install the latest f2py, see test-site/a/runme.py.
It is currently the only test that uses the latest features and I would
expect also that it is the only test that would pass on Windows. Try it.
Usage of the latest f2py should be really easy. In fact, f2py acts also
like a compiler with the -c switch.
Here is a small but a complete example:
Fortran file foo.f:
subroutine foo(a,b)
integer a,b
cf2py intent(in) a
cf2py intent(out) b
b = a + 2
end
Compile a wrapper for foo():
$ f2py -c -m example foo.f
And here you go in Python:
$ python
Python 2.1.1 (#1, Nov 11 2001, 18:19:24)
[GCC 2.95.4 20011006 (Debian prerelease)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import example
>>> example.foo(5)
7
>>>
That's it!
Currently f2py should work with the following compilers:
NAG,Intel,VAST,gcc
without problems, I just have tested them.
Note that f2py.bat that will be generated in Python21/Scripts under
Windows is not tested. Please, if you can fix it, send it me too.
Regards,
Pearu