I am trying to communicate ATL COM dll with PHP. I am able to call the COM dll function and pass and retrieve the int/long values to and from PHP. But not able to access and print BSTR value in PHP.
Finally I got the solution. To return string to PHP following code worked in my COM code.
STDMETHODIMP CMyClass::MyFun(BSTR in, VARIANT* o)
{
// TODO: Add your implementation code here
VariantClear(o);
o->vt = VT_BSTR;
o->bstrVal = ::SysAllocString(in);
return S_OK;
}
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more