Re: Function Pointer of Class Member Function in Cocoa
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