I am trying to pass a single dimension array from a FORTRAN program to C.
The C function is called but the values that it holds are garbage. But whereas if I try ca
Passing arrays between Fortran and C is a non-trivial problem. The particular C and Fortran compilers matter.
The first problem I see is that you specify double
to match real*4
. That is certainly invalid on almost all platforms. Declare the C function as:
int test_func (float *a)
This could work on some platforms, though many Fortran compilers pass the address of an "array descriptor" and not the array itself. Check the documentation for the Fortran compiler.