Hello, try this: --- import std.stdio;
alias Proc = size_t function();
size_t allInnOne()
{
asm pure nothrow
{
mov RAX, 1;
ret;
nop;nop;nop;nop;nop;nop;nop;
mov RAX, 2;
ret;
}
}
void main()
{
Proc proc1 = &allInnOne;
Proc proc2 = cast(Proc) (cast(void*)proc1 + 16);
writeln(proc1(), " ", proc2());
}
---
The call to proc1() gens a SEGFAULT after the first RET.
Remove the call to proc1() and it works.
Why that ?
