Since Objective-C is a C superset, all Objective-C specific statements are converted into C statements during the compiling of a .m file (by the preprocessor, I guess). So, for example, a message expression like [receiver method]
is converted into a call on the messaging function objc_msgSend(receiver, selector)
.
My question is: if I have a class definition like this:
@interface ClassA {
int var1;
float var2;
id var3;
}
-(void) method1;
-(int) method2: (int) num1;
@end
@implementation ClassA
-(void) method1 {
// Implementation of the method
}
-(int) method2: (int) num1 {
// Implementation of the method
}
@end
what is it converted into by the compiler (in 2.0 version of Objective-C)? Is it converted into calls on functions like objc_allocateClassPair()
, class_addIvar()
, class_addMethod()
and objc_registerClassPair()
, in order to create the class, add its instance variables, add its methods and register the class, respectively (So that the class struct is actually defined in runtime instead of being loaded as a struct from the executable file)?