The `NSInvocation' class The NSInvocation is used to programmatically construct method calls. You set the target object, the selector and the arguments of the method and then you invoke the message by sending the -invoke message to the invocation object. After the message returns you can examine or modify the returned value. When you send a message to an object that doesn't implement the corresponding method, the forwardInvocation: method is called with an invocation object as argument. You can set another target to it and resend the original message to this object. The value returned by the original message is the value obtained from the invocation. So by modifying this value you change the returned value of the original message. Implementation notes For a given machine you must define the following macros: * FUNCTION_VALUE * FUNCTION_SET_VALUE * GET_STRUCT_VALUE_ADDRESS * SET_STRUCT_VALUE_ADDRESS FUNCTION_VALUE should copy the return value from the result frame returned by the __builtin_apply pseudo-function into a memory zone received as argument. This macro has the following arguments: * TYPE (char*): the Objective-C encoding of the return value type * ARGS (void*): the arguments frame passed to __builtin_apply * RESULT_FRAME (void*): the result frame returned by __builtin_apply * RETURN_VALUE (void*): the memory zone where the value should be set. This zone is already allocated. FUNCTION_SET_VALUE should set the return value into the result frame returned by the __builtin_apply. It has the following arguments: * TYPE (char*): the Objective-C encoding of the return value type * ARGS (void*): the arguments frame passed to __builtin_apply * RESULT_FRAME (void*): the result frame returned by __builtin_apply * RETURN_VALUE (void*): the memory zone where the returned value should be copied from. GET_STRUCT_VALUE_ADDRESS is an expression that should produce the return value address in the case this is returned by reference or NULL if the return value is not returned by reference. Usually only the aggregates (structures and unions) are returned by reference. This macro has the following arguments: * ARGS (void*): the arguments frame passed to __builtin_apply. Usually the address of return value is set here by the __builtin_apply_args pseudo-function * RETTYPE (char*): the Objective-C encoding of the return value type. SET_STRUCT_VALUE_ADDRESS should set in the arguments frame that will be passed to __builtin_apply the address of the return value if this is returned by reference. The arguments are: * ARGS (void*): the arguments frame that will be passed to __builtin_apply * ADDR (void*): the address of the zone where the called function should set the return value. This zone is already allocated. * RETTYPE (char*): the Objective-C encoding of the return value type