[Gambas-user] Signal 11 with callback functions

Benoît Minisini gambas at ...1...
Sun Mar 13 14:11:16 CET 2011


> Can someone explain what extern callbacks are/do?
> 
> Thanks!
> 

Some external functions written in C ask for a function pointer argument.

In Gambas 3, you can use any private or public function written in Gambas as 
function pointer. The interpreter internally creates a temporary internal C 
function (a "closure") that will be actually sent to the external function. 
That closure will call the original Gambas function each time it is called.

Each argument that is a function pointer creates its own closure. All these 
closures are internally stored in a hash table that is cleared when the 
program exits.

If you do not send any function pointer to an external function, then the hash 
table is not created, so there is no overhead at all.

Regards,

-- 
Benoît Minisini




More information about the User mailing list