• 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: C callbacks with NSNotificationCenter?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >C callbacks with NSNotificationCenter? (From: Andreas Falkenhahn <email@hidden>)
 >Re: C callbacks with NSNotificationCenter? (From: Fritz Anderson <email@hidden>)
 >Re: C callbacks with NSNotificationCenter? (From: Andreas Falkenhahn <email@hidden>)
 >Re: C callbacks with NSNotificationCenter? (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Can you have a helper scripts in a sandboxed app?
  • Next by Date: Why doesn't this crash?
  • Previous by thread: Re: C callbacks with NSNotificationCenter?
  • Next by thread: Re: C callbacks with NSNotificationCenter?
  • Index(es):
    • Date
    • Thread