Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

beginner question: void ** ?

Status
Not open for further replies.

strugggling

Programmer
Jul 18, 2003
13
US
hi to everyone...

can someone explain
void **
used in the following context


interface IFoo1: public IUnknown
{
...
};

IFoo1* pIFoo1 = NULL;
HRESULT hr = ::CoCreateInstance(CLSID_Component, NULL,
CLSCTX_INPROC_SERVER,
IID_IFoo1,
(void **) &pIFoo1);


 
That would be a pointer to a IFoo pointer, casted to a pointer to a void*.

Maybe more clear: The address in which a pointer to the IFoo interface will be placed after the call to CoCreateInstance has succeeded.

Greetings,
Rick
 
If we passed only the pointer we can't change the value of thepointer(we can only change the contents pointed to by the pointer). So we pass the address of the (interface) pointer. so we need another level of indirection. CoCreateInstance() takes a void** parameter. So we need to type cast the actual parameter to void**.
-S.Kannan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top