Calling D functions from C
downs
default_357-line at yahoo.de
Tue May 27 10:12:10 PDT 2008
BCS wrote:
> Reply to Matthias,
>
>
>> # extern (C) int myFunctionWrapper (char a, int b, char* c)
>> # {
>> # return myFunction (a,b,c); // myFunction is a normal D function.
>> # }
>
> that deserves a template.
> I guess I known what to do at lunch today.
>
>
template Forward(string NAME) {
mixin("extern(C) ReturnType!(&"~NAME~") c_"~NAME~"(ParameterTypeTuple!(&"~NAME~") p) {
return "~NAME~"(p);
}");
}
Untested, but should work.
--downs
More information about the Digitalmars-d-learn
mailing list