I have a data type defined using KIND parameter
INTEGER :: dp = selected_real_kind(P=15)
REAL(KIND=dp), dimension(10) :: arr
Now I want to pass this array to a C function that I call via iso_c_binding. I believe the interoparate type for double in C is real(c_double) in Fortran. However, this doesn’t have the same kind with the data I defined above. The compiler gives me the “type mismatch” error.
INTERFACE
integer(c_int) function c_foo_func (arr, size) bind(c)
real(c_double) :: arr
integer(c_int), value :: size
end
end interface
Could someone suggest me a solution for this.
Thanks
Tuan