Re: Calling ObjC instance method from C
Re: Calling ObjC instance method from C
- Subject: Re: Calling ObjC instance method from C
- From: Jeff Disher <email@hidden>
- Date: Fri, 2 May 2003 18:14:26 -0400
You can call Obj-C instance methods from a C function if you pass in
(or instantiate) the correct instance. I don't think that you will be
able to do this from a .c file, though, since the Obj-C compiler will
only be used for .m (or .mm or .M) files.
For example, this works:
void printItForMe(foo *object1, int num)
{
[object1 printIt:num];
}
where instances of the class foo respond to the message printit:
Does that help?
Jeff.
On Friday, May 2, 2003, at 05:37 PM, David G. Johnson wrote:
Hi,
I am developing my first Cocoa application. It uses a modified version
of
Apple's IOKit USBNotification example which is in a C file. I have no
problem calling C functions from Objective-C objects but have not
figured
out how to call Objective-C instance methods from the C functions in
USBNotification.
I want to call methods in my interface controller class from a C file.
What
is a good way to do this?
Thanks,
Dave
_______________________________________________
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.
Jeff Disher
President and Lead Developer of Spectral Class
Spectral Class: Shedding Light on Innovation
http://www.spectralclass.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.