On 2018-09-16 16:12, Guillaume Piolat wrote:
Anyone has any information about the ABI of delegates?
In particular how to call them with a particular "this"/frame pointer?
You can explicitly set the context pointer of a delegate using the
".ptr" property:
class Foo
{
void bar() { }
}
void main()
{
auto a = new Foo;
void delegate () dg;
dg.ptr = cast(void*) a;
dg.funcptr = &Foo.bar;
dg();
}
To solve a hairy problem I need a delegate with a synthesized frame
pointer.
https://dpaste.dzfl.pl/cf44417c98f9
The problem is that delegate forwarding seems to require GC closures. I
want manually-managed closures.
--
/Jacob Carlborg