Re: C callbacks with NSNotificationCenter?
Re: C callbacks with NSNotificationCenter?
- Subject: Re: C callbacks with NSNotificationCenter?
- From: Andreas Falkenhahn <email@hidden>
- Date: Sat, 10 Sep 2016 12:49:55 +0200
On 08.09.2016 at 00:47 Graham Cox wrote:
>> On 8 Sep 2016, at 3:44 AM, Andreas Falkenhahn <email@hidden> wrote:
>> How can I access "IMPORTANT_DATA_PTR" from within the block above?
> You already did it. Variables are captured from the scope where the
> block is declared and “magically” get referenced within the block.
> So what you’ve written should work.
> Have you tried it?
I didn't try it because I thought that the block wouldn't have access to
variables from the outer scope but apparently that isn't the case. It's
indeed working fine. So just using a block that calls the C function is the
perfect solution to my problem. No need for creating a class and using
selectors, I can just use a block that calls a C function. Nice.
> (You might want to more strongly type your parameters though, void* is a nasty idea).
Well, this was just an example of course and the void* just a placeholder.
--
Best regards,
Andreas Falkenhahn mailto:email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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