C# COM DLL, SAFEARRAY question

 

i have a C++ dll that calls a C# COM dll

my c++ dll is of course called by MT4, and is just a wrapper for my C# stuff. t

my c++ function, analyze(double *opens), needs to convert the double array to a SAFEARRAY


I googled and found some sample code that helped me. I came up with this:


for (int i = 0; i < arraySize; i++) {
VARIANT vOut;
VariantInit(&vOut);
vOut.vt = VT_R8;
vOut.dblVal = opens[i];
LONG index[1] = {i};
SafeArrayPutElement(safeDates, index, &vOut);
}

my C# function is analyze(double[] opens)

it seems that this code runs without crashing, but when i pass these SAFEARRAYS into my C# function the values of the double[] are all -9.25596313487193E+61

 
bump