• 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: Fawzi Mohamed <email@hidden>
  • Date: Fri, 4 May 2001 14:40:19 +0200

Well in object oriented programming functions are always kept with the data the act on. They are normally called methods and are seen to be part of the object.
Thus you call a method you should always call it on an object. A method of an object can call another method of the same object through "self".
If you call from a c function you cannot call methods on the same object (there is no default object). You will have to call the method on a precise object that you obtain by other means.

If your method does not need the context of the object, then you shoul make it a class method (+ instread of -). Then (if you defined it in MyClass) you will be able to call it with
[MyClass myMethod];

If you use obj-c calls from a function you should define it in a .m file.
Otherwise I think you should read:
/Developer/Documentation/Cocoa/ObjectiveC/ObjC.pdf

regards
Fawzi
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);
-- Sincerely,
Rosyna Keller
Technical Support/Holy Knight/Always needs a hug

Unsanity: Unsane Tools for Insane People
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


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

  • Prev by Date: Re: searching info, doc, examples for OS X cocoa app
  • 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