• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: invalid conversion from void* to void**
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: invalid conversion from void* to void**


  • Subject: Re: invalid conversion from void* to void**
  • From: Chris Hanson <email@hidden>
  • Date: Sat, 7 Oct 2006 21:09:18 -0700

On Oct 6, 2006, at 8:58 PM, Alfred Van Hoek wrote:

Might be trivial, but what used to compile does not anymore:


Given:

    IOFireWireAVCLibUnitInterface** avcUnit;
   
    // ask for the AVC unit interface
    result = (*interface)->QueryInterface( interface,
    CFUUIDGetUUIDBytes( kIOFireWireAVCLibUnitInterfaceID ),
    (LPVOID)&avcUnit );

The compiler chokes on (LPVOID)&avcUnit. This is how it should be called though, (LPVoid)avcUnit will lead to a crash. Any pointers?

Your declaration of avcUnit is incorrect.  QueryInterface returns a void* (in COM terms, an LPVOID) by reference.  Thus you need to pass it a pointer to a void* like so:

    IOFireWireAVCLibUnitInterface *avcUnit;
   
    // ask for the AVC unit interface
    result = (*interface)->QueryInterface( interface,
    CFUUIDGetUUIDBytes( kIOFireWireAVCLibUnitInterfaceID ),
    (LPVOID)&avcUnit );

Now — assuming there was no error returned — avcUnit is a pointer to an IOFireWireAVCLibUnitInterface that you can interact with.

  -- Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >invalid conversion from void* to void** (From: Alfred Van Hoek <email@hidden>)

  • Prev by Date: Re: method list strangeness
  • Next by Date: Re: Xcode comments
  • Previous by thread: Re: invalid conversion from void* to void**
  • Next by thread: re-indent bug
  • Index(es):
    • Date
    • Thread