I can compile the following code just fine using gfortran -c test.f90
.
module math
contains
function addition(a, b) result(f)
use iso_fortran_env, only: REAL64
implicit none
real(REAL64), intent(in) :: a, b
real(REAL64) :: f
f = a + b
end function
end module
I use f2py
python -m numpy.f2py -c test.f90 -m test
and I get the following error
/tmp/tmpJLxRSe/src.linux-x86_64-2.7/test-f2pywrappers2.f90:7:16:
real(kind=real64) a
1
Error: Parameter ‘real64’ at (1) has not been declared or is a variable, which does not reduce to a constant expression
I have verified that I can successfully use selected_real_kind(15,307)
, as suggested in this SO post. However, I was interested in using iso_fortran_env, if possible.