On 08.09.2016 at 00:47 Graham Cox wrote:
>> On 8 Sep 2016, at 3:44 AM, Andreas Falkenhahn <andr...@falkenhahn.com> 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:andr...@falkenhahn.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com