Luís Oliveira | 26 Aug 2011 01:20
Picon
Gravatar

Re: Passing address of pointer

Hello Frank,

On Thu, Aug 25, 2011 at 6:19 PM, Frank Goenninger <frgo <at> me.com> wrote:
> In the sample code from Apple the C function is called like this:
>
> typedef struct MyPrivateData {
>    io_object_t            notification;
>    IOUSBDeviceInterface   **deviceInterface;
>    CFStringRef            deviceName;
>    UInt32                 locationID;
> } MyPrivateData;

Why is deviceInterface a pointer to a pointer?

> IOCFPlugInInterface     **plugInInterface = NULL;
> SInt32                  score;
> HRESULT                 res;
>
> res = (*plugInInterface)->QueryInterface( plugInInterface,
>                                          CFUUIDGetUUIDBytes( kIOUSBDeviceInterfaceID ),
>                                          (LPVOID*) &privateDataRef->deviceInterface );

--

-- 
Luís Oliveira
http://r42.eu/~luis/

Gmane