Callbacks are an alpha feature of Rebol2. See Carl's article for documentation.
Essentially, if you have a dll such as test-lib.dll where the test function takes two integers and returns them again unchanged
extern "C"
MYDLL_API int test(int a, int b, int (*pFunc)(int, int))
{
int result = pFunc(a, b);
return result;
}
you would write the calling function from Rebol like this
test: make routine! [
a [int]
b [int]
c [callback [int int return: [int]]]
return: [int]
] test-lib "test"
So, this test function takes two integers as parameters and a third parameter which is a Rebol function to be used as a callback. The callback in the routine! is a keyword. The block specification is automatically turned into a structure!
The callback function is written like this which takes the two integers returned by the library call, adds them, and returns them.
add-it: func [a b][return a + b]
And it's then used like this
>> test 1 2 :add-it
== 3