CComVariant platformOutVar;
.....
hr = (pDSPEngine->foo(LibraryName,SpecialFunctionName,inVar,&platformOutVar));
STDMETHODIMP CDSPEnginePC_PI::foo( BSTR LibraryName, BSTR SpecialFunctionName, VARIANT paramIn, VARIANT * paramOut)
{
for (auto it = m_vectorCommBuff.begin(); it != m_vectorCommBuff.end(); it++)
{
HRESULT hr = it->get()->foo1(LibraryName,SpecialFunctionName,paramIn,paramOut);
}
}
HRESULT CDSPEngPCCommBuff::foo1( BSTR LibraryName, BSTR SpecialFunctionName, VARIANT paramIn, VARIANT * paramOut)
{
CommBufEntry buf(SYNC, AAA);
CComVariant inVar(paramIn);
CComBSTR libName(LibraryName);
CComBSTR sfuncName(SpecialFunctionName);
buf.bstrData1 = libName.Detach();
buf.bstrData2 = sfuncName.Detach();
inVar.Detach(&buf.varData1);
buf.pVarPtr1 = paramOut;
AddCommand(buf);
SysFreeString(buf.bstrData1);
SysFreeString(buf.bstrData2);
LogHResultError(buf.err, __FUNCTION__" LibraryName=%S, SpecialFunctionName=%S", LibraryName, SpecialFunctionName);
return buf.err;
}
The method CDSPEnginePC_PI::foo has output parameter as type Variant *. I need to convert this Variant * to Safearray *.
But the ouput param of function foo1 should be Varaint *. So I need to create a local variant pointer and pass it to foo1 instead of paramOut.
I need to create a safearray and pass this output variant of foo1 to that safearray and return it. Please help in achieving that.
What I have tried:
I tried to change the function signature from variant to safearray and got the error while compiling, cannot initiate abstract class. I modified in header file too. still get that error.