Hoping not to offend people from NeXT and without patronizing, ObjC is a
special language syntax that a compiler can understand and translate into a
special set of assembly language instructions that dispatch your function
calls accordingly. The upshot is that you can freely mix these language
dialects (C and ObjC) together as long as you make sure that the compiler
knows how to handle ObjC language constructs (i.e. @end or the square
bracket for method invocations), for instance using the standard file
extension of .m or .mm, which also means that you could write a straight C
program and call a single ObjC function (like NSLog) and as long as you link
it with an ObjC framework like Foundation or AppKit the compiler will
translate the constructs into dylib calls and the linker will bind those
calls correctly. There's a nice and fairly thorough explanation of all this
in NeXT's revamped ObjC Programming Language manual in one of the last
chapters. In short, here's what you already suggested in your response and
it works both by definition and from experience:
void callbackFunction(..., void *info) {
[(ControllerClass *)info callbackMethod:...];
}
-----Original Message-----
From: Juan Pablo Pertierra [mailto:email@hidden]
Sent: Tuesday, May 10, 2005 6:31 PM
To: Vincenzo Kreft-Kerekes
Cc: email@hidden
Subject: Re: USB Callbacks and Cocoa App...
Thanks for your reply,
I understand what you are suggesting, however I am not sure how I can:
> dispatch the C function call into a matching ObjC
> method invocation, i.e. pass it through to let your object handle it
> using
> the ObjC runtime system.
What do you mean by pass it through? Do you mean simply calling the
desired method in my controller class from the callback using the
pointer? Since the callback is a C function, can I even use the
[controllerclassinstance method:arg] format, or do I need to somehow
put it into Standard C syntax?
Thanks,
Juan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden
This email sent to email@hidden