delegates with C linkage

dennis luehring dl.soluz at gmx.net
Sat Jun 5 05:19:45 PDT 2010


Am 05.06.2010 13:33, schrieb Zarathustra:
>>  Secondly, I'm not sure if you can pass delegates to a C function. C code
>>  wouldn't understand delegates. They are not the same as function
>>  pointers. I suggest you use function pointers instead, paying attention
>>  to linkage.
>
> Of course It is possible, because I have done it and it works pretty well.

only with static methods - a real delegate needs the this-pointer in a 
register (not on the stack), thats the main difference between function 
ptr and delegates, thats why you can't use a (non static) method on for 
example the win-api callbacks, because the caller don't know your object


More information about the Digitalmars-d-learn mailing list