Hi,
Is there any way to use a python function in FORTRAN? I was given a python script that contains some functions and I need to access this function from a FORTRAN code.
I've seen 'f2py' which allows a FORTRAN subroutine to be accessed from Python, and py2exe which will compile python script to an executable. Is there anything out there for 'py2f'? Can a Python script be compiled to an object file? Then I could link it with the FORTRAN code.
For example consider 'mypython_func.py' as a Python script containing a function and 'mainfortran.f' as the main program FORTRAN code which calls the Python function. I would like to: from 'mypython_func.py' compile to 'mypython_func.o', from 'mainfortran.f' compile to 'mainfortran.o' (>> gfortran -c mainfortran.f), then link these files (>> gfortran -c mainfortran.o mypython_func.o -o myexec.exe). Is anything like this possible?
Thank you for your time and help.
Vince