CALLFUNCPOINTER FunctionWindows/Unix

CALLFUNC will execute the function pointer that was bound by using BIND.

Syntax: CALLFUNC(fptr, param1, param2, ...)
CALLFUNC(FPtr, 10, 20)

Depending on how you BIND your function pointer, you can either call CALLFUNC as a statement or a function. Make sure to supply the necessary number of parameters, else you will receive a compile error. Passing function pointers as parameters is not yet implemented, but you can read up on Chapter 11 to see how to emulate this.

CALLFUNC  requres parentheses in some cases:
sub procedure1
   ' Do things...
end sub
function procedure2 as long
   procedure2 = 1
end function

dim lres as long
dim fnptr1 as integer
dim fnptr2 as integer

bind fnptr1 to procedure1
bind fnptr2 to procedure2

callfunc fnptr1              'This works
callfunc fnptr2              'This also works
lres=callfunc(fnptr2)        'This doesn't work. Compiler error
lres=callfunc fnptr2         'This doesn't work. Compiler error
lres=(callfunc(fnptr2))      'This WORKS!!!