• 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: "R. Eranki" <email@hidden>
  • Date: Thu, 13 Dec 2001 15:21:07 -0500

Well, self is something which will only work within methods because it
refers to the instance of a class...

If I'm reading you correctly, you're trying to do something like this:

---------------

- (void)doSomething
{
// ...
}

Bool cFunction(char *foo)
{
[self doSomething];
}

int main(int argc, char **argv)
{
return cFunction("foo");
}


---------------

That will NOT work. You need to start defining some classes, or use
pre-built ones (not using 'self').

Exactly -what- are you attempting to do?


On 12/13/01 10:19 AM, "Rosyna" <email@hidden> wrote:

> 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 ?


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

  • Prev by Date: Subclass of TextView in ScrollView
  • Next by Date: Re: buy that new Book?
  • Previous by thread: Re: ObjC from C
  • Next by thread: Re: ObjC from C
  • Index(es):
    • Date
    • Thread