• 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: 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


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

  • Prev by Date: Calling Cocoa methods from C
  • Next by Date: Re: searching info, doc, examples for OS X cocoa app
  • Previous by thread: Calling Cocoa methods from C
  • Next by thread: Re: Calling Cocoa methods from C
  • Index(es):
    • Date
    • Thread