Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

C calling FORTRAN array of pointers

bgpalmer
Beginner
767 Views
I have a C function that needs to call a FORTRAN function, passing it an array of pointers. The C prototype for the interface is:

typdef void (*callbackfunc) (double *t, int *h1, int *h2, int *numAs, int Ahs[], int *aVs[]);

The last argument "int *aVs[]" is where I'm confused on the FORTRAN side. The actual data contained in the aVs array could be of type integer or double, and I need to be able to 'cast' this to the appropriate type in the corresponding fortran function. I belive I need to use some type of 'transfer mold' or something... but I'm just not sure. Any ideas on what the corresponding FORTRAN subroutine would look like for receiving the "int*[]" argument and being able to cast that to an integer or double array for processing?

Thanks,

Brian Palmer
0 Kudos
1 Reply
Steven_L_Intel1
Employee
767 Views
An array of type C_PTR from ISO_C_BINDING. You'll then need to use C_F_POINTER to convert each element to a Fortran POINTER to INTEGER.
0 Kudos
Reply