Re: How to callback into a Obj-C object from C?
Re: How to callback into a Obj-C object from C?
- Subject: Re: How to callback into a Obj-C object from C?
- From: Dan Wood <email@hidden>
- Date: Thu, 15 Aug 2002 13:14:00 -0700
Just keep track of the "self" parameter so you can send a message back
to the appropriate object.
For instance, in CURLHandle <
http://curlhandle.sourceforge.net/>, the C
callback invokes ObjC like this:
/*" Callback from reading a chunk of data. Since we pass "self" in as
the "data pointer",
we can use that to get back into Objective C and do the work with the
class.
"*/
size_t curlBodyFunction(void *ptr, size_t size, size_t nmemb, void
*inSelf)
{
return [(CURLHandle *)inSelf curlWritePtr:ptr size:size number:nmemb
message:BODY];
}
On Thursday, August 15, 2002, at 10:50 AM, Pete wrote:
I have a bunch of C code that I want to control printf statements and
funnel back into a NSTextField. So how do I bridge and external C
callback into an Obj-C object i.e. NSTextField object?
Pete
_______________________________________________
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.
--
Dan Wood
Karelia Software, LLC
email@hidden
http://www.karelia.com/
Watson for Mac OS X:
http://www.karelia.com/watson/
_______________________________________________
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.