CPW
CPW

Reputation: 83

Communicate ATL COM dll with PHP

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.

Please guide me, sample example is more helpful.

.

Upvotes: 0

Views: 109

Answers (1)

CPW
CPW

Reputation: 83

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;
}

Upvotes: 1

Related Questions