On Tue, Mar 18, 2014 at 3:48 PM, Charles R Harris <charlesr.harris@gmail.com
wrote:
On Tue, Mar 18, 2014 at 3:25 AM, Sturla Molden <sturla.molden@gmail.com>wrote:
Skipper Seabold <jsseabold@gmail.com> wrote:
I guess I have a question. Does anyone have an option on the best way forward for the Fortran 90 code? We have to stick to Fortran 77 code, unfortunately, so my options are to either fix the code incrementally for F77 or ... ?
It is basically undoable. Do you know Fortran 77 that well?
I learned Fortran 90 about 20 years ago. I couldn't write valid Fortran 77 even if I wanted to -- even though I am fluent in Fortran 90. And that is probably the case for most scientists that use Fortran today.
If you tried, you would even have to change loops into gotos. Good luck on that...
Coding Fortran 77 in 2014 is not worth the effort.
What do people think about using f2c to generate and include C code? I've never done this before, and I assume it comes with its own can of worms.
This will not help you out.
f2c is a Fortran 77 compiler.
f2c and g77 was written by the same person (as one-man projects), and they basically do the same except for what they emit (C or machine code, respectively). The original f77 compiler was a shell script that invoked f2c and system cc. g77 came along because pointer aliasing prevented C compilers from doing certain optimizations (e.g. register allocation). With a modern C compiler it is probably better to use f2c than the g77 compiler, but it will still be inferior to modern Fortran compilers (gfortran, ifort, absoft).
Wasn't there a Cython project for wrapping Fortran? IIRC, it had the opposite problem, it could wrap newer versions of Fortran but couldn't hack Fortran 77.
And a bit of googling turns up fwrap, which stalled before completion. The current advice seems to be to use ISO_C_BINDING and then Cython. Chuck