Community
cancel
Showing results for 
Search instead for 
Did you mean: 
yiw
Beginner
98 Views

Exchange data between Fortran and C++

Hi,

Can C++ program access data in allocatable array defined in Fortran Module? My C++ program can access scalar values defined in Fortran module, but got error "symbol not found" when tried to access fixed-size & dynamic arrays. Please help!

Thanks!
0 Kudos
4 Replies
TimP
Black Belt
98 Views

This is an interesting question, and I haven't seen a full answer to it. You are more likely to get that answer on the Fortran linux forum.

Legacy programs are likely to use the Cray pointer facility for dynamic arrays to be shared between C++ and Fortran, but I certainly don't advocate that. Fixed size single subscripted Fortran arrays are seen in C as a pointer to the first element of the array. When you say "symbol not found," do you mean a link error?
yiw
Beginner
98 Views

Hi tcprince,

Thank you for your reply!

"Symbol ... not found" was shown when I ran debugger. I made some progress after I posted my question yesterday. Now my C++ program can access scalar data, data of fixed-size arrays. But it still cann't access data of dynamic arrays, meaning values are worng.

I would appreciate any ideas, suggestions.

Thanks,

Wendy
98 Views

are they multi dimensional arrays?
fortran accesses data column wise (ie first index is cycled through first)
C accesses data row wise (ie cycles through last index of the array)
98 Views

DAVE!

Nice to see you here. Keep up those great questions and answers!

cheers

jdg

Reply