Contents

OSMemberFunctionCast

Converts a C++ member function pointer, relative to an instance, to a C-style pointer to function.

Declaration

#define OSMemberFunctionCast(cptrtype, self, func)

Parameters

  • cptrtype:

    The function type declaration to cast to (typically provided as a typedef by I/O KitKit classes).

  • self:

    The this pointer of the object whose function you wish to cache.

  • func:

    The pointer to the member function itself, something like &Class::function.

Return Value

A pointer to a function of the given type referencing self.

Discussion

This function is used to generate pointers to C++ functions for instances, such that they can be registered as callbacks with I/O Kit objects.

No warnings are generated.

This function will panic if an attempt is made to call it with a multiply-inheriting class.

See Also

Miscellaneous