building a DLL
I am writing in C++ a DLL for a program, that is probably written in Fortran. This DLL includes a function, that has several arguments, and some of them are then returned as results. Problem is, that some arguments are one- or two-dimensional array of float or double and I don't know, how to declare function header properly.
For non-dimensional variables, this is easy: I just add the & sign (like int &PrjLen) and the value of the PrjLen variable is returned properly to the main program. But for one- and two-dimensional arrays, this does not work. I tried several combinations (like double &Matrix1, double &Matrix2, double Matrix3, double Matrix4, ...), yet none of them worked.
Please help me?
here is how I declare it in header file for a function that can be called by c or c++. I suspect it could be used by fortran too, but don't know for sure.
extern "C" __declspec(dllimport) double __cdecl foo(double matrix);