Iso_c_binding: pass an array from c to fortran (Edit: python interop content)

Calling convention mismatch between C and Fortran also applies to function pointers passed around the different processors.
In your cmodule.h the function pointer has interface:

typedef double (*func_ptr)(double);

while your Fortran function square is the equivalent to

double (*func_ptr)(double *);

Try changing the Fortran function to accept real(real64), value :: x. This should fix the issue.

1 Like