Content deleted Content added
No edit summary |
Cfrs~enwiki (talk | contribs) fixed lexical closure paper link |
||
Line 15:
** When passing a [[callback (computer science)|callback]] to a system that expects to call a [[C (programming language)|C]] function, but one wants it to execute the method function of a particular instance of an object written in [[C++]], one uses a short ''trampoline'' to convert the C function-calling convention to the C++ method-calling convention. One method of writing such a trampoline is to use a [[thunk]].<ref>[http://einaros.blogspot.com/2006/08/thunking-in-win32.html "Thunking in Win32 with C++"], Einar Otto Stangvik</ref> Another method is to use a ''generic listener''.<ref name="muller">[http://java.sun.com/products/jfc/tsc/articles/generic-listener/index.html "Trampolines in Java"], Hans Muller</ref>
* In [[Objective-C]], a trampoline is an object returned by a method that acts like a [[Delegation (programming)|delegate]], "bouncing" a message on to another object.
* In the [[GNU Compiler Collection|GCC]] [[compiler]], trampoline refers to a technique for implementing pointers to [[nested function]]s. The trampoline is a small piece of code which is constructed on the fly on the stack when the address of a nested function is taken. The trampoline sets up the static link pointer, which allows the nested function to access local variables of the enclosing functions. The function pointer is then simply the address of the trampoline. This avoids having to use "fat" function pointers for nested functions which carry both the code address and the static link.<ref>[http://gcc.gnu.org/onlinedocs/gccint/Trampolines.html GCC internals: Trampolines for Nested Functions]</ref><ref>[http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html GCC nested function usage]</ref><ref>[http://
== High level programming ==
|