Re: Callbacks in C libraries
Re: Callbacks in C libraries
- Subject: Re: Callbacks in C libraries
- From: Eric Shepherd <email@hidden>
- Date: Sat, 14 Jun 2003 23:49:47 -0400
I have no idea. I heard from a friend that something like this was
possible, so I experimented for a while until it worked. :)
On Saturday, June 14, 2003, at 09:05 PM, Prachi Gauriar wrote:
On Saturday, June 14, 2003, at 07:47 PM, Eric Shepherd wrote:
What I've discovered is that I can prototype my callback in my
class's header file, then actually include my callback function right
inside the method that results in it being called, like this:
- (int) doScan: (ConfigRec *)cfgRec {
int CallbackFunc(ConfigRec *cfgRec, const DataRec *pRecord) {
[fileList addObject: [NSString stringWithCString:
pRecord->filename]];
// More code here
return 0;
}
RunFileScan(cfgRec, CallbackFunc);
}
This works like a charm.
Is this standard C (ANSI or C99), or is it a GCC feature?
-Prachi
--
Eric Shepherd
Owner
Syndicomm
http://www.syndicomm.com
_______________________________________________
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.