Assume we need to call fortran function, which returns some values, in python program. I found out that rewriting fortran code in such way:
subroutine pow2(in_x, out_x)
implicit none
real, intent(in) :: in_x
!f2py real, intent(in, out) :: out_x
real, intent(out) :: out_x
out_x = in_x ** 2
return
end
and calling it in python in such way:
import modulename
a = 2.0
b = 0.0
b = modulename.pow2(a, b)
gives us working result. Can I call fortran function in other way, cause I think the first way is a bit clumsy?