Why can't you do that with existing language features? alias JniExternFunc!(void function(int)) someJNIFuncYouWantToCallFromD; mixin JniExportFunc!(&dFuncYouWantToCallUsingJNI); Where the templates generate the wrapper code/calling convention arg shuffle for each function.