This method performs name-lookup method resolution, determines the method procedure appropriate for performing the indicated method on instances of the receiving class, and loads m with the method procedure address. For static methods, method procedure resolution is done using the instance method table of the receiving class.
Name-lookup resolution must be used to invoke dynamic methods. Also, name-lookup can be useful when different classes introduce methods of the same name, signature, and desired semantics, but it is not known until runtime which of these classes should be used as a type for the objects on which the method is to be invoked. If the signature of a method is a not known, then method procedures cannot be be used directly, and the somDispatch method can be used after dynamically discovering the signature to allow the correct arguments can be placed on a va_list.
As with any method that returns procedure pointers, this method allows repeated invocations of the same method procedure to be programmed. If this is done, it up to the programmer to prevent runtime errors by assuring that each invocation is performed either on an instance of the class used to resolve the method procedure or of some class derived from it. Whenever using SOM method procedure pointers, it is necessary to indicate the arguments to be passed and the use of system linkage to the compiler, so it can generate a correct procedure call. The way this is done depends on the compiler and the system being used. However, C and C++ usage bindings provide an appropriate typedef for static methods. The name of the typedef is based on the name of the class that introduces the method, as illustrated in the example below.
If the class does not support the specified method, then *m is set to NULL and the return value is meaningless. Otherwise, the returned result is true if the indicated method was a static method.