Passando uma matriz int do Fortran para C ++ chamando a função C ++ no Fortran
Estou tentando chamar uma função C ++ em uma sub-rotina Fortran. Esta função C ++ deve atualizar uma matriz inteira. Aqui está um código não útil que escrevi. Qual é o problema?
! Fortran function that calls a C++ function.
subroutine my_function()
integer(4) ar(*)
integer(4) get_filled_ar
! Need correct syntax here.
ar = get_filled_ar()
end
// C++ function:
extern "C" {
void get_filled_ar(int *ar){
ar[0] = 1;
ar[1] = 10;
ar[3] = 100;
}
}