The client side is float array into a VARIANT array first:
Float para [4]={1, 2, 3, 4};
//double VARIANT
The VARIANT varArg1;
SAFEARRAY * psa;
SAFEARRAYBOUND rgsabound [1].
Rgsabound [0]. LLbound=0;
Rgsabound [0]. CElements=4;//this is the length of the array,
Psa=SafeArrayCreate (VT_R4, 1, rgsabound);//VT_I4 specified 4 byte signed int
For (long k=0; K & lt; (long) 4; K++)
{
SafeArrayPutElement (psa, & amp; K, & amp; Para [k]);//this is conversion
}
VarArg1. N=VT_ARRAY | VT_R4;//specify the VARIANT data type integer array
VarArg1. Parray=psa;//assignment
Out-of-process COM component is a VARIANT array to float array:
//the VARIANT double
Float * pValue=https://bbs.csdn.net/topics/NULL;
SAFEARRAY * pArray=varArg1. PArray;
SafeArrayAccessData (pArray, (void * *) & amp; PValue);
Long Low (0), High (0);
SafeArrayGetLBound (pArray, 1, & amp; Low);
SafeArrayGetUBound (pArray, 1, & amp; High);
LONG I;
The float u [4];
For (I=Low; I{
U=pValue [I] [I];
}
CodePudding user response:
Process address should be used