Right now I have to do something like this:
PROTOTYPE prType : a#
FUNCTION test: a#
LOCAL testPr As prType
testPr = test
FUNCTION prPass: testPr As prType
prPass(testPr)
Is it possible to implement direct passing of the function:
prPass(test)
-------
You need to create a function pointer(a variable of type PROTOYPE) to pass a it as a function parameter AFAIK. You shouldn't however need to assign the PROTOYPE every time in a local var for each call.
Runnable code may be helpful to understand where you are and where you want to be TBH.
Uhm. Would this be OK?
PROTOTYPE prType : a# // notify compiler: There is a prototype for foo(double), returns double.
LOCAL testPr AS prType // create a variable, that can hold a pointer to a function of type prType
testPr = test // set the variable's value to the address of 'test' - function and prototype MUST match!
testPr(123) // call 'test' by the pointer to it.
FUNCTION test: a#
ENDFUNCTION
Yes, that's how you do it, but why not write the function name directly as a parameter?