Say I am interfacing to C.
Here is an wrapping function to the interface.
@property extern(C) void onEvent(void function(InterfaceStruct*, int, int, int) nothrow callback)
{
interfaceSetCallback(handle, callback);
}
All good.
wrapper.onEvent = function void (InterfaceStruct*, int x, int y, int z) nothrow
{
if (x == 11) doSomething();
};
Uh oh:
Error: function foo.bar.onEvent (void function(InterfaceStruct*, int, int, int) nothrow callback) is not callable using argument types (void function(InterfaceStruct* _param_0, int x, int y, int z) nothrow @nogc @safe)
So, it wants me to have the function literal being extern(C). So how can I do that? I can't find any way to do so.