pythonfortranfortran77f2py

Compile legacy fortran77 code as python module using f2py


I am able to successfully compile FORTRAN77 code, but only when specifying -std=legacy in

gfortran -o -std=legacy -o model.exe model.FOR

Without -std=legacy, I get some fatal errors. I wish to similarly specify a legacy compiler when attempting to build a python module. Presently the following call generates the same fatal errors as those when omitting -std=legacy using gfortran.

f2py -c -m pymodel model.FOR --fcompiler=gnu95 

Any suggestions on how to ensure f2py uses a legacy compiler compatible with antiquated FORTRAN77 code?


Solution

  • Are you actually just asking how to pass that flag to the compiler? stackoverflow.com/questions/28380548/…

    Vladimir F provided a good reference. f2py compiles when passing the argument of interest into --opt="__":

    f2py -c --opt='-std=legacy' -m pymodel model.FOR --fcompiler=gnu95