I know there are lots of topics about this issue, but I still can't figure out how to do it. Sorry...
I am working on a mixed fortran/C++ code (VS2010/IVF 2013.1.119). The fortan part is quite old (most is fortran IV). Up to now, all variables are in COMMON blocks, and accessed by C++ using extern "C" struct.
However, I am now implementing some new features using modules and allocatable variables, that must also be accessed by C++. I've searched and read about it, but could not make it work. BTW: my knowledge of C++ is very, very basic.
The original code for the module is:
integer(4) :: CaseNumArea
real(8), dimension(:), allocatable :: areaINTER
integer(4), dimension(:), allocatable :: area2ext
character(len=36), dimension(:), allocatable :: areaNOME
integer(4) :: ext2area(998)
logical(1), dimension(:), allocatable :: areaLFRSelect
end module AreaData
As long as I could figure out, I should include use iso_c_bindind, change interger(4) to integer(C_INT), real(8) to real(C_DOUBLE), logical(1) to logical(C_BOOL). The basic questions: (i) what about the character variable? (ii) how would the C++ code look like? (iii) is it necessary to use BIND(C)?
Thanks for the help.
PS: How do I insert a code block into the post?