Re: Passing Obj-C method as callback to C function
Re: Passing Obj-C method as callback to C function
- Subject: Re: Passing Obj-C method as callback to C function
- From: Bill Cheeseman <email@hidden>
- Date: Tue, 28 Oct 2003 15:12:36 -0500
on 03-10-28 9:58 AM, email@hidden at email@hidden wrote:
>
Is it possible to have the callback in the object itself.
Yes. In addition to the option to put it in the @implementation part at
large, there is often an advantage to embedding it inside the Objective-C
method that triggers the callback. I believe this is covered in the gcc3
document in DeveloperTools under "Nested Functions," where it is explained
that a function can be defined at the beginning of any block within an
Objective-C method. Code examples can be found by searching the mamasam
archive for "embed function in method," if I recall correctly. An advantage
of doing this is that "self" is available to the function without having to
pass it in as a void* parameter.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.