Passing function pointer in Dlang
From the interfacing to C guidelines on callbacks:
D can easily call C callbacks (function pointers), and C can call callbacks provided by D code if the callback is an extern(C) function, or some other linkage that both sides have agreed to (e.g. extern(Windows)).
So I think you need your onError
function to be declared as extern(C)
in order for it to match the type signature.