GetObjectMethodPtr (open)
Creates a function pointer to an object method
Syntax
// Core function, no LOADLIB necessary
FUNCTION PTR FUNCTION GetObjectMethodPtr(OBJECT obj, STRING membername)
Parameters
OBJECT obj
Object to bind
STRING membername
Member name of the method to create the function pointer
Return value
FUNCTION PTR
A function pointer which, when called, executes the specified method on the speified object.
Description
GetObjectMethodPtr takes an object function-member, and returns a function pointer that when called executes that method on the passed object (this is also known as a closure). Member names are case insensitive.
Examples
OBJECTTYPE <
INTEGER FUNCTION CallMe() > otype;
OBJECT o := NEW otype;
// Create a function pointer for o->callme
FUNCTION PTR myptr := GetObjectMethodPtr(o, "CALLME");