Accessing class/instance methods from USB callback?
Accessing class/instance methods from USB callback?
- Subject: Accessing class/instance methods from USB callback?
- From: Juan Pablo Pertierra <email@hidden>
- Date: Wed, 11 May 2005 22:08:47 -0500
I'm having some trouble in my cocoa app, I am calling USB Async
functions which have Standard-C callbacks.
I want the USB callback function to trigger a method in MyController
class. So, when I call the AsyncRead, i pass an argument to the
callback function, which contains a pointer to MyController instance.
Then, I use [(MyController*)arg myMethod] to trigger the method from
the C callback function.
However, this only seems to work if I define myMethod as a class
method. If I define it as an instance method then I get an error:
+[MyController myMethod]: selector not recognized
If I make it a class method, then it gets called but I can't access the
instance variables I need from the MyController instance, which is the
whole reason i'm calling a method of MyController in the first place.
So, I guess this can be solved in two ways: How can I use an instance
method instead of a class method from the C callback? Or, how can I
access an instance variable from a class method?
Thanks,
Juan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden