• 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: Mixing Obj-C and C "methods"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mixing Obj-C and C "methods"


  • Subject: Re: Mixing Obj-C and C "methods"
  • From: Maxthon Chan <email@hidden>
  • Date: Tue, 30 Jul 2013 21:44:43 +0800

My common way of handling this would be NSNotificationCenter. It is a singleton so I am always sure that it is there, and I can wrap all parameters into the userInfo dictionary.

Sent from my iPhone

> On 2013年7月30日, at 21:19, KappA <email@hidden> wrote:
>
> I sometimes just access my objc-objects from a C thread-proc via the
> AppDelegate (providing there's a trail to the object I need, which there
> usually is)... If the callback void pointer parameter isn't being used for
> something else, you can simply cast the object in there... or if you need
> multiple parameters you can create a struct that stores what you need and
> pass that. Not sure if this helps but figured I'd mention it.
>
> AppDelegate *d = [[UIApplication sharedApplication] delegate];
>
>
>
>> On Tue, Jul 30, 2013 at 8:53 AM, lowell <email@hidden> wrote:
>>
>> The first two parameters to the function have to be an id and a SEL ...
>>
>>    typedef id (*IMP)(id, SEL, ...);
>>
>> ... (this is where we get self and _cmd, by the way) followed by the rest
>> of the method params, if any.
>>
>>
>> lowell
>>
>>
>>> On Jul 30, 2013, at 12:59 AM, Vincent Habchi <email@hidden> wrote:
>>>
>>> Hi everybody,
>>>
>>> I have a very simple question: if I embed a C-function (more precisely,
>> a callback from an external C-library) in an Obj-C object, can I expect
>> this function to behave like a regular method? I.e. can it freely access
>> ‘self’ and other attributes?
>>>
>>> Thanks a lot!
>>> Vincent
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>>
>>> 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
>>
>>
>> _______________________________________________
>>
>> 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
> _______________________________________________
>
> 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

_______________________________________________

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


  • Follow-Ups:
    • Re: Mixing Obj-C and C "methods"
      • From: Jean-Daniel Dupas <email@hidden>
    • Re: Mixing Obj-C and C "methods"
      • From: Tom Davie <email@hidden>
  • Prev by Date: Re: Thread safety, some basic questions about accessing mutable objects across threads
  • Next by Date: Synchronous Serial Port Protocol messaging With NSOperationQueue/GCD
  • Previous by thread: Re: Reloading table view header or footer
  • Next by thread: Re: Mixing Obj-C and C "methods"
  • Index(es):
    • Date
    • Thread