Re: Using C?
Re: Using C?
- Subject: Re: Using C?
- From: Bob Savage <email@hidden>
- Date: Fri, 15 Jun 2001 23:31:34 -0700
>
The only real problem I've experienced with my C method is that it seems
>
unable to call methods of access variables in the same object. Calling
>
stuff like [self: doSomething] within the C method results in the
>
warning "self undeclared." Is it not possible to mix up C and Objective-C
>
like this? Also, for example, any variables declared in the header file for
>
the object are also inaccessable in the C function/method.
This has little to do with Obj-C. "self" is a variable that is out of scope.
The relation to Obj-C is that the Obj-C runtime provides "self" as a hidden
argument to method calls. If you use it in a C function, it is your
responsibility to define it and assign it a value. I wouldn't recommend it,
though. It would just get confusing. Instead try definig the function to
include a descriptive variable of type id (or more precisely typed if you so
choose). E.g.
void superFunc( id orbulator, int timing) {
[orbulator initiateOrbingSequenceAfter: timing];
}
best of luck,
Bob