Hello,
My Fortran program contains the following:
REAL(KIND = R8), DIMENSION(:), ALLOCATABLE :: L, U
INTEGER :: N
N = 2
L(1:N) = (/0.0, 0.0/)
I modified the program and it looks like this now
INTERFACE
SUBROUTINE inputs(L_array, arr_shape) BIND(C,name='inputs')
IMPORT c_double,c_int,c_ptr
type(c_ptr),value :: L_array
integer(c_int), intent(in), dimension(2) :: arr_shape
END SUBROUTINE inputs
END INTERFACE
SUBROUTINE inputs(L_array, arr_shape) BIND(C)
USE ISO_C_BINDING
USE VTdirect_MOD
IMPLICIT NONE
type(c_ptr),value :: L_array
integer, intent(in), dimension(1) :: arr_shape_L
real, dimension(:), pointer :: L
integer :: n
call c_f_pointer(L_array, L, arr_shape_L)
print *, "L in fortran:", L
do j = 1, n
print *,L(j)
end do
END SUBROUTINE
My JAVA program contains the following lines
double[] l = new double[]{0.0,0.0};
int[] y = new int[]{2};
lib.inputs(l,x);
But, when I run this program,
I get the following output
L in fortran: 0.0000000000000000 0.0000000000000000
6.9518704107813286E-310
1.3339772437713657E-322
What am I doing wrong?