int C function
Andrej Mitrovic
andrej.mitrovich at gmail.com
Fri Sep 30 18:20:21 PDT 2011
I think this is a side-effect of the new function pointer fixes, where
you now can't implicitly convert an extern(C) function to an extern(D)
function by accident (and that's a good thing). But the problem is,
you can't define a function with a different linkage type inline as a
type parameter. You have to use an alias instead:
extern (C) int puts(const char* s);
alias extern(C) int function(const char*) FunPtr;
class X
{
@property void tt(FunPtr xz)
{
}
}
void main()
{
X x = new X();
x.tt = &puts;
}
(sorry for reindenting, my script does that :p)
More information about the Digitalmars-d-learn
mailing list