Re: Calling Cocoa methods from C
Re: Calling Cocoa methods from C
- Subject: Re: Calling Cocoa methods from C
- From: John Hörnkvist <email@hidden>
- Date: Fri, 4 May 2001 14:23:09 +0200
On Friday, May 4, 2001, at 01:34 PM, Rosyna wrote:
How do i go about calling a Cocoa/Objc function I made in a C function.
If I do
[self methodName] I get an error message "self is not defined" The
calling function is designed as
void frontAndCenter(ProcessSerialNumber psn);
"self" only exists in methods. You need to have a pointer to the object
you're sending the message to.
You could pass the object as an argument, allocate it in the fuction or
even use a global variable, but you have to get a reference from
somewhere. If possible I'd rewrite the function as a method. If not, I'd
give the function an extra arguement:
void frontAndCenter(ProcessSerialNumber psn, id theObject);
Regards,
John Hornkvist