• 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: Passing C Style Function Callbacks in Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing C Style Function Callbacks in Cocoa


  • Subject: Re: Passing C Style Function Callbacks in Cocoa
  • From: Vince Ackerman <email@hidden>
  • Date: Thu, 8 Apr 2004 07:14:21 -0700

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.


  • Follow-Ups:
    • Re: Passing C Style Function Callbacks in Cocoa
      • From: Vince Ackerman <email@hidden>
References: 
 >Re: Passing C Style Function Callbacks in Cocoa (From: Vince Ackerman <email@hidden>)
 >Re: Passing C Style Function Callbacks in Cocoa (From: Hiro Fujimoto <email@hidden>)
 >Re: Passing C Style Function Callbacks in Cocoa (From: Clark Cox <email@hidden>)

  • Prev by Date: outlest are null
  • Next by Date: Re: "Ignore Ownership on this volume" check-box status
  • Previous by thread: Re: Passing C Style Function Callbacks in Cocoa
  • Next by thread: Re: Passing C Style Function Callbacks in Cocoa
  • Index(es):
    • Date
    • Thread