I have this very small example of Fortran code which I would like to understand please.
subroutine test_iso_c
use ISO_C_BINDING
implicit real(c_double) (a-h,o-z)
real :: var, expression
interface
real(c_double) function test (y) bind( c )
use ISO_C_BINDING
real(c_double), value :: y
end
end interface
! call
var = test(expression) ! - expression is a real declared variable which is calculated using simple arithmetic operation.
end
Can you explain to me thee following (I assume c_double means double precision in a C code scope?)
1 - What does implicit real(c_double) (a-h,o-z)
?
2 - what does value
and bind(c)
do in the function interface
3 - I saw this of code as part of a larger routine, can you say what this test function provide/do?