Call Fortran subroutine from C++

I have a problem to call fortran subroutine from C++.

"Poziv_Cholesky.cpp", line 35: Error: Formal argument matrix of type complex* in call to cholesky_(complex*, complex*, int*) is being passed complex(*)[200][200].
"Poziv_Cholesky.cpp", line 35: Error: Formal argument arrayb of type complex* in call to cholesky_(complex*, complex*, int*) is being passed complex(*)[200].

I don't understand this message.If somebodey know...
I think I have a problem with pointer.
My program in[b] C++ is:

struct complex
{
float real;
float imag;
};

extern"C" {
extern void cholesky_(complex* matrix, complex* arrayb, int* N);
}
...
complex matrix[200][200],arrayb[200];
...
cholesky_( &matrix, &arrayb, &N);
...
In Fortran
SUBROUTINE cholesky(YD,b,N)

COMPLEX,DIMENSION(1:200,1:200) ::YD,Lt,L,LxD,D
INTEGER ::N,i,j
COMPLEX,DIMENSION(1:200) ::b,Z,X
...
I think this is enough.
Sorry becouse my english is not so good...
Last edited on
1. The actual syntax varies with compilers. You'll need to state what compiler you're using.
2. C/C++ and Fortran index 2D Arrays in different orders.
Topic archived. No new replies allowed.