Re: Passing C Style Function Callbacks in Cocoa
Re: Passing C Style Function Callbacks in Cocoa
- Subject: Re: Passing C Style Function Callbacks in Cocoa
- From: Vince Ackerman <email@hidden>
- Date: Fri, 9 Apr 2004 07:08:56 -0700
Can anyone help?
On Apr 8, 2004, at 07:14, Vince Ackerman wrote:
Clark, Hiro, and others.
Thanks for responding. This C Style function callback is outside of
any objects and passed to 3rd party code I'm using with their USB
device. The "tmdin" value is an instance variable in one of my objects
(the address of one of the USB devices making the callback) and not an
object in itself. My problem was to be able to send a message to my
object from the callback that the device's variable (aValue) had
changed. I originally wanted to be able to pass off a method in my
object as the callback, but the third party code only takes a C style
function set up with the two variables (TMioDin*, bool). Assigning my
object to a "static id myObject" was a work around that seemed to
work for a while, but maybe it is being flushed somehow. How do I
create a variable like this outside of any other object and retain it?
Perhaps the solution is to send a NSNotification from the callback?
Would that work outside all objects?
Thanks
Vince
On Apr 8, 2004, at 05:06, Clark Cox wrote:
What's wrong with:
TeleoError IODinValueCB( TMioDin* tmdin, bool aValue)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // fixes
memory leak for some reason
[tmdim updateValue: aValue];
[pool release];
return TELEO_OK;
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.