- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page