• 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: ObjC from C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ObjC from C


  • Subject: Re: ObjC from C
  • From: Thomas Lachand-Robert <email@hidden>
  • Date: Thu, 13 Dec 2001 17:29:45 +0100

I don't understand the problem. Actually any Obj-C program starts by calling a C function, namely main(argc,argv). And you can call Obj-C methods from any C function, if in a .m file.

On the other hand you call a C function and try to use 'self', that's certainly wrong. 'self' refers to the current object in a method, there is no such thing in a C function.

Le jeudi 13 dicembre 2001, ` 04:19 , Rosyna a icrit :

Hmm, it'll let me do it that directly? When Ever I tried it before, I'd always get lots of errors, like "self not defined" then I cried for 2 days and saw a psychiatrist about it.

Ack, at 12/13/01, Charles Srstka said:

Really, he's telling the truth. Rename the .c file so it ends with .m. Import the headers for the class you want to call the methods from. This should work.

On Thursday, December 13, 2001, at 12:56 AM, Rosyna wrote:

That's the thing, it has to start out as straight C. How can I call a Objective C class? What code example?

Ack, at 12/13/01, Erik M. Buck said:

Of course.

Implement SomeLameCFunction(char * bob) in a *.m file or use the compiler
option to force it to use Objective-C when compiling that module.
Why would anyone doubt this ? This is exactly what Apple's own code example
do. What else could the phrase "Super-set of ANSI C" mean ?
Thomas Lachand-Robert
********************** email@hidden
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.


References: 
 >Re: ObjC from C (From: Rosyna <email@hidden>)

  • Prev by Date: Re: ObjC from C
  • Next by Date: Re: GhettoWeb
  • Previous by thread: Re: ObjC from C
  • Next by thread: Re: ObjC from C
  • Index(es):
    • Date
    • Thread