• 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: Access Obj-C method/attribute from a C method
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Access Obj-C method/attribute from a C method


  • Subject: Re: Access Obj-C method/attribute from a C method
  • From: Eric MORAND <email@hidden>
  • Date: Sat, 7 Jul 2007 09:39:50 +0200

Unfortunately, I can't. ObjectAdded is a callback function (of type IOServiceMatchingCallback) with a fixed number of parameters.


IOServiceMatchingCallback



Callback function to be notified of IOService publication.

typedef void (*IOServiceMatchingCallback)(
    void *refcon,
    io_iterator_t iterator );
Parameters
refcon
The refcon passed when the notification was installed.
iterator
The notification iterator which now has new objects.


Le 7 juil. 07 à 09:25, Scott Stevenson a écrit :


On Jul 7, 2007, at 12:13 AM, Eric MORAND wrote:

void ObjectAdded(void * refCon, io_iterator_t iterator)
{
	// A lot of things are done...

	[self addObjectToFooArray:anObject];
}

Unfortunately, it doesn't compile :

error: 'self' undeclared (first use in this function)

Is there a way to achieve what I need ?

Just pass in the object that you want to work with as an argument:

void ObjectAdded(void * refCon, io_iterator_t iterator, FooBar* myObject)
{
// A lot of things are done...


	[myObject addObjectToFooArray:anObject];
}



    - Scott
_______________________________________________

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


References: 
 >Access Obj-C method/attribute from a C method (From: Eric MORAND <email@hidden>)
 >Re: Access Obj-C method/attribute from a C method (From: Scott Stevenson <email@hidden>)

  • Prev by Date: Re: Access Obj-C method/attribute from a C method
  • Next by Date: Re: Access Obj-C method/attribute from a C method
  • Previous by thread: Re: Access Obj-C method/attribute from a C method
  • Next by thread: Re: Access Obj-C method/attribute from a C method
  • Index(es):
    • Date
    • Thread