• 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: Function Pointer of Class Member Function in Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Function Pointer of Class Member Function in Cocoa


  • Subject: Re: Function Pointer of Class Member Function in Cocoa
  • From: Darrin Cardani <email@hidden>
  • Date: Tue, 21 Jun 2005 19:48:17 -0500

At 4:04 PM -0700 6/21/05, Zehao Chang <email@hidden> wrote:
I'm writing a cocoa app that uses Quicktime's sequence grabber, one of the SG functions SGSetDataProc, requires a function pointer to a function. Normally this would be a carbon function, but since my dataproc function needs reside in a Cocoa class and call its member functions, I need to set the DataProc function to a function within my Cocoa class ... How do I obtain a function pointer to a member
function of a cocoa class?

What I generally do in a case like this is write a C function for the callback, and pass a pointer to the object as the refCon or userData value. Then the C function can simply cast the userData value back to a pointer to an Objective-C object, and use it as you would any other object.


Darrin
--
Darrin Cardani - email@hidden
President, Buena Software, Inc.
<http://www.buena.com/>
Video, Image and Audio Processing Development
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: WWDC 2004 Source Code
  • Next by Date: Re: How to set a default row in NSTableView?
  • Previous by thread: Re: Function Pointer of Class Member Function in Cocoa
  • Next by thread: WWDC 2004 Source Code
  • Index(es):
    • Date
    • Thread