I’m trying to use Julia to wrap a FORTRAN subroutine taking several arrays as arguments. The issue is that the subroutine receives garbage as the array values (1e-314 etc), so I must be defining something wrong for the ccall
. I’ve attached a minimal FORTRAN and Julia combo that reproduces my issue.
FORTRAN:
SUBROUTINE ADD(x, y)
real*8, INTENT(in) :: x(2)
real*8, INTENT(out) :: y(2)
y(1) = x(1) + 1
y(2) = x(2) + 2
write(*,*) x
write(*,*) y
END SUBROUTINE ADD
Julia:
x = [1.0, 2.0]
y = [0.0, 0.0]
ccall( (:add_, "./test.so"), Nothing, (Ref{Array{Float64,1}}, Ref{Array{Float64,1}}), Ref(x), y )
When the FORTRAN routine writes x it gets something like 2.2435970063560449E-314 9.8813129168249309E-324.
Any thoughts or suggestions would be helpful.