Right way to pass a NULL Pointer to a out of process COM Method in an ATL Project

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
What is the right way to pass a NULL Pointer to a out of process COM Method in an ATL Project? I have created a COM Server hosted through a COM Surrogate
If it matters I am using VS2012 running on Win 7. The Server Project is compiled in 64 bit and the Client Project in 32 bit
The IDL looks similar to belowimport "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(37EFA952-7036-4398-93A6-6CDAD9DFC005),
dual,
nonextensible,
pointer_default(unique)
]
interface IGame : IDispatch
{
[id(1)] HRESULT passNull([in, unique] BSTR* avast, [out, retval] LONG* r);
};

The declaration is STDMETHOD(passNull)(BSTR* avast, LONG* r);

and the definition
STDMETHODIMP CGame::passNull(BSTR* avast, LONG* r)
{
*r = 0;
return S_OK;
}

And my client Code isvoid main()
{
CoInitialize( NULL ) ;
IGamePtr p( __uuidof( Game ) ) ;
p->passNull(NULL);
p= NULL ;
CoUninitialize() ;
}

My understanding was, adding unique to the qualifier would allow me to pass a NULL through a pointer, but strangely, I keep on getting the message_hr0x800706f4 : A null reference pointer was passed to the stub. HRESULT

View the full article
 
Back
Top