A solution

ore-sama spam at here.lot
Mon Oct 27 04:29:07 PDT 2008


downs Wrote:

> When asked to convert a function pointer to a delegate, the compiler could create a small stub that converts from delegate calling convention to FP calling convention, then put that stub in .funcptr and the FP in .ptr.

Interestingly, on x86-32 this stub can be generated only once and placed before function prologue (and exported):

Delegate stub:
    pop eax
Function prologue:
    push ebp
    mov ebp, esp

if last parameter is not stored in eax, their calling conventions are compatible and stub is empty :)



More information about the Digitalmars-d mailing list