delegates with C linkage

Zarathustra adam.chrapkowski at gmail.com
Sat Jun 5 04:33:09 PDT 2010


> For starters, your first delegate is declared in an extern(C) block,
> meaning it has C linkage. The second is declared outside of the block,
> meaning it has D linkage. So they are two different types of delegates.
What is the difference?

> 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.

> On an unrelated note, what are you expecting the static keyword to do in
> your function declaration? It does not restrict function visibility to
> module scope, as it does in C and C++. That's what private is for. Here,
> static is meaningless.

I expecting nothing :) I use it only to highlight that it is not a member function.


More information about the Digitalmars-d-learn mailing list