Re: Calling an object from a C function
Re: Calling an object from a C function
- Subject: Re: Calling an object from a C function
- From: Kenny Leung <email@hidden>
- Date: Tue, 19 Aug 2008 16:39:04 -0700
Example:
void cFunction(MyObject *myObject) {
int myInt;
int result;
myInt = initializeMyInt();
result = [myObject myMethod:myInt];
printf("result:%i", result);
}
On Aug 19, 2008, at 4:28 PM, Charlie Dickman wrote:
What is the syntax? For example, how do I invoke the method
- (int) myMethod: (int) int;
In object myObject
from within a C (not Objective C) function and make use of the result?
In Objective C I would invoke
[myObject myMethod: myInt];
Even better, how do I invoke
- (myObject) myMethod: (myObject *) myObjectArg;
an make use of the result in a C function?
On Aug 19, 2008, at 6:52 PM, David Duncan wrote:
On Aug 19, 2008, at 2:53 PM, Gilbert Mackall wrote:
I have a C function from which I would like to call a method. I
can't find any documents the cover how to do this.
You call it just like you call any other method. Your C function
will need to be compiled with the Obj-C compiler however. Easiest
way to do this is to name the source file with a .m extension.
--
David Duncan
Apple DTS Animation and Printing
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Charlie Dickman
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden