Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)
4975 Discussions

Exchange data between Fortran and C++

yiw
Beginner
555 Views
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
Honored Contributor III
555 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?
0 Kudos
yiw
Beginner
555 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
0 Kudos
david_a_levinthal
555 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)
0 Kudos
jeffrey-gallagher
555 Views

DAVE!

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

cheers

jdg

0 Kudos
Reply