Re: C callback function
Re: C callback function
- Subject: Re: C callback function
- From: Sherm Pendley <email@hidden>
- Date: Sat, 3 Mar 2007 01:41:54 -0500
On Mar 3, 2007, at 1:20 AM, Guy Meyer wrote:
I have got a C callback function within an object.
The said callback function needs access one of the objects variables.
If the said object was a singleton the solution was to create a
global variable outside the scope of the object accessible to both
the object and the c callback function.
However, as the object is instantiated multiple times the said
global variable can not be shared amongst all callback functions
and should be unique for each object.
Any suggestion will be appreciated.
Most APIs that use callbacks allow you to pass "user data" as an
argument to the registration function, and then pass that data back
to your callback function unchanged. You can use that to pass the
object pointer.
sherm--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden