• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Calling Cocoa methods from C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Calling Cocoa methods from C (From: Rosyna <email@hidden>)

  • Prev by Date: Re: Calling Cocoa methods from C
  • Next by Date: Re: Calling Cocoa methods from C
  • Previous by thread: Re: Calling Cocoa methods from C
  • Next by thread: Re: Calling Cocoa methods from C
  • Index(es):
    • Date
    • Thread