somApply - Remarks

This function provides a single uniform interface through which it is possible to call any method procedure. The interface is based on the caller passing: the object to which the method procedure is to be applied; a return address for the method result; a somMethodDataPtr indicating the desired method procedure; and an ANSI standard va_list structure containing the method procedure arguments. Different method procedures expect different argument types and return different result types, so the purpose of this function is to select an apply stub appropriate for the specific method involved, according to the supplied method data, and then call this apply stub. The apply stub removes the arguments from the va_list, calls the method procedure with these arguments, accepts the returned result, and then copies this result to the location pointed to by retVal.

The method procedure used by the apply stub is determined by the content of the somMethodData structure pointed to by mdPtr. The class methods somGetMethodData and somGetNthMethodData are used to load a somMethodData structure. These methods resolve static method procedures based on the receiving class's instance method table.

The SOM API requires that information necessary for selecting an apply stub be provided when a new method is registered with its introducing class (via the methods somAddStaticMethod or somAddDynamicMethod). This is required because SOM itself needs apply stubs when dispatch method resolution is used. C and C++ implementation bindings for SOM classes support this requirement, but SOM does not terminate execution if this requirement is not met by a class implementor. Thus, it is possible that there may be methods for which this function cannot select an appropriate apply stub. If an apply stub can be selected, then somApply performs as described above, and a TRUE value is returned; otherwise FALSE is returned.


[Back: somApply - Parameters]
[Next: somApply - Related Information]