delegates with C linkage
adam.chrapkowski at gmail.com
Sun Jun 6 08:30:41 PDT 2010
> my fault - yes its possible to use delegates in non D but delegat-struct
> knowing languages (and a small pice of special calling code), sorry
> Zarathrustra i missed the point of your post in whole
No problem, I'm glad that we have reached an agreement.
> wouldn't it be nice to have an complete call/use D features through c
> example around?
It would be great, if the DMC will provide such extensions like the dthiscall (for
member functions) and the dcall (for static functions). Additionally would be
great if DMC will works on other OS than MSWindows. But probably there are only my
I think there is a good chance for create the set examples which show how to use D
features on the C level. I will thinking about it in my free time :) The idea is
really interesting and it would be useful(especially to better understand these
mechanisms) for some people.
> are delegats part of the ABI, i can't find a delegat calling scheme in
> the ABI-Description - should this be in EAX, as last/first part on
> stack, ECX?
The delegates are called by exactly same way as any other member function. Put ptr
= 'this'(context pointer) to EAX and call funcptr (pointer to function). If I
remember well, the 'this' pointer is passed to functions by ECX in C++. The
delegate structure layout is described in ABI. ABI, disassembler and
trail-end-error method will give you (and me too, because I still need to explore
many things) an answer to many questions.
> I say this is a bug.
Thanks for confirming my suspicions.
More information about the Digitalmars-d-learn