Re: Calling Cocoa methods from C
Re: Calling Cocoa methods from C
- Subject: Re: Calling Cocoa methods from C
- From: David P Henderson <email@hidden>
- Date: Fri, 4 May 2001 08:44:37 -0400
On Friday, May 4, 2001, at 07:34 , 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);
>
That is because C doesn't speak Objective C. You need to use the C
function objc_msgSend defined in /usr/include/objc/objc-runtime.h. See
Apple's Object Oriented Programming and the Objective-C Language,
chapter 2 "The Objective-C Language" under "How Messaging Works" pg 78.
Dave
--
Chaos Assembly Werks
"The proper office of a friend is to side with you when you are in the
wrong. Nearly anybody will side with you when you are in the right."
- Mark Twain