Follow-on question about delegates

Jerry Quinn jlquinn at optonline.net
Tue Jun 9 08:54:39 PDT 2009


OK, having thought a bit more about delegates, I now have another question.

The ABI shows a delegate as consisting of a context ptr and a function ptr.  The context ptr can be a class reference, ptr to struct, ptr to closure or ptr to stack frame.

If you're passing one of these delegates into another function, how does the receiving function figure out what kind of context it's looking at?  Each of these things will look different in memory.  Also, structs at least don't have a header that can be used to disambiguate the situation.

Thanks,
Jerry




More information about the Digitalmars-d mailing list