Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.

passing array from Fortran to C++

jw
Beginner
679 Views
I would like to pass an array of structures from Fortran to C++. The C++ routine will populate the array of structures and return the values to my Fortran routine.

My Fortran code has the variable defined as:
RECORD/MY_STRUCT/ MY_ARRAY[100]

- How do I pass my "MY_ARRAY" to the C++ routine?
- How is MY_ARRAY defined in the C++ routine?
0 Kudos
1 Reply
TimP
Honored Contributor III
679 Views
Quoting - wong
I would like to pass an array of structures from Fortran to C++. The C++ routine will populate the array of structures and return the values to my Fortran routine.

My Fortran code has the variable defined as:
RECORD/MY_STRUCT/ MY_ARRAY[100]

- How do I pass my "MY_ARRAY" to the C++ routine?
- How is MY_ARRAY defined in the C++ routine?
You could start by reading about iso_c_binding. The C++ function would have to be declared extern "C" as there is no portable way to deal with C++ name mangling.
0 Kudos
Reply