gcc: Messaging with the GNU Objective-C runtime

1 
1 8.10 Messaging with the GNU Objective-C Runtime
1 ===============================================
1 
1 This section is specific for the GNU Objective-C runtime.  If you are
1 using a different runtime, you can skip it.
1 
1  The implementation of messaging in the GNU Objective-C runtime is
1 designed to be portable, and so is based on standard C.
1 
1  Sending a message in the GNU Objective-C runtime is composed of two
1 separate steps.  First, there is a call to the lookup function,
1 'objc_msg_lookup ()' (or, in the case of messages to super,
1 'objc_msg_lookup_super ()').  This runtime function takes as argument
1 the receiver and the selector of the method to be called; it returns the
1 'IMP', that is a pointer to the function implementing the method.  The
1 second step of method invocation consists of casting this pointer
1 function to the appropriate function pointer type, and calling the
1 function pointed to it with the right arguments.
1 
1  For example, when the compiler encounters a method invocation such as
1 '[object init]', it compiles it into a call to 'objc_msg_lookup (object,
1 @selector(init))' followed by a cast of the returned value to the
1 appropriate function pointer type, and then it calls it.
1 

Menu