Hi!
I have constructed a com-object in visual c++. This object will just
return an array of variants. The method connected to the interface has
one out parameter that consists of a pointer to a variant. I dont know
how labview handles this type. It seems that it doesnt recognize the
type. It just gives the error message, "A null reference pointer was
passed through the stub"?!?! I have also written a com-client in c++
that communicates with this com-server. This one works fine! How does
labview handles arrays?! I have also tried to just return one "Variant
value" from the server. Same problem here, "A null....".#"¤%"%
com-server implementation:
STDMETHODIMP CTEEServices::TestVariant7(VARIANT inData, VARIANT
*pOutData)
{
VariantInit(pOutData);
LPVOID pvdata;
int *pElement;
pOutData->vt=VT_ARRAY;//Set VARIANT type to array
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound=0;
rgsabound[0].cElements=10;//10 elements
pOutData->parray=SafeArrayCreate(VT_I4,1,rgsabound); //Create a
safearray in VARIANT
pvdata=pOutData->parray->pvData; //Get address to array
pElement=(int*)pvdata;
for(int i=0;i<10;i++) //Fill it up!
{
*pElement=i;
pElement+=1;
}
return S_OK;
}
regards,
Peter
Sent via Deja.com http://www.deja.com/
Before you buy.