NAME
trampoline - closures as first-class C functionsSYNOPSIS
#include <trampoline.h> function = alloc_trampoline(address, variable, data); free_trampoline(function);is_trampoline(function) trampoline_address(function) trampoline_variable(function) trampoline_data(function)
DESCRIPTION
These functions implement closures as first-class C functions. A closure consists of a regular C function and a piece of data which gets passed to the C function when the closure is called.
trampoline_address(function) returns address,
trampoline_variable(function) returns variable,
trampoline_data(function) returns data.
SEE ALSO
gcc(1), stdarg(3), callback(3)BUGS
Passing the data through a global variable is not reentrant. Don't call trampoline functions from within signal handlers. This is fixed in the callback(3) package.PORTING
The way gcc builds local functions is described in the gcc source, file gcc-2.6.3/config/cpu/cpu.h.AUTHOR
Bruno Haible <[email protected]>ACKNOWLEDGEMENTS
Many ideas were cribbed from the gcc source.1 January 2017 |