I managed to use the extern C trick to use my fortran routine

unfortunately

I am able to pass only plain double, float and integers, not array or

vectors.

If I pass a vector or an array everything compiles but the numbers

that are undestood as input in the fortran are actually meaningless

(7.823e-231 and similar things)

There must be some evil in the passing of the arguments that are not

plain scalars.

I declared the routine as

extern "C" {

void vxxxxx_(vector<double>&, double&, int&, int&, complex<

double>*);

}

the fortran has

subroutine vxxxxx(p,vmass,nhel,nsv , vc)

double precision p(0:3)

but then the components of p print out silly numbers ...

As they should. The vector is not a simple sequence of elements, it's

an object that contains data members, and a pointer to a dynamic array

is usually one of them.

Do you have idea how to pass a vector or an array?

Most likely there is no way to pass a vector straight up *if* the other

side (Fortran) does not have an equivalent type. What you usually do is

pass the address of the first element of the vector, and on the Fortran

side use the array, like you have:

extern "C" {

void vxxxxx_(double*, ....

}

subroutine vxxxxx(p, ...

double precision p(0:3)

As for the array of 'complex<double>', it might be even trickier. You

should consider decomposing it into the array of the real parts and the

array of the imaginary parts, and passing them separately. Or, maybe

there is a way to declare a two-dimensional array on the Fortran side,

but you need to experiment to see what members you get where.

extern "C" {

void vccccc_(complex<double>*);

}

subroutine vccccc(cplx)

double precision cplx(0:100,1:2)

c cplx(x,1) = real part

c cplx(x,2) = imaginary part

maybe... Or maybe the indices are swapped and you should say

subroutine vccccc(cplx)

double precision cplx(1:2, 0:100)

c cplx(1,x) = real part

c cplx(2,x) = imaginary part

Now, those things aren't really defined in C++. You're in the

compiler-specific territory. No warranties attached.

V