diff --git a/include/jnivm/class.h b/include/jnivm/class.h index 25ee6be..dd096c3 100644 --- a/include/jnivm/class.h +++ b/include/jnivm/class.h @@ -103,7 +103,7 @@ namespace jnivm { } }; - template struct HookManagerHelper2::plength > (EnvArg ? 1 : 0) || ((int)bind & (int)FunctionType::Setter) && Function::plength > (EnvArg ? 2 : 1))>> { + template struct HookManagerHelper2::plength > (EnvArg ? 1 : 0)) || (((int)bind & (int)FunctionType::Setter) && Function::plength > (EnvArg ? 2 : 1)))>> { static void install(ENV* env, Class* cl, const std::string& id, T&& t) { impl::HookManagerHelper::install(env, cl, id, std::move(t)); } diff --git a/src/jnivm/internal/method.cpp b/src/jnivm/internal/method.cpp index 9773cf5..2e4330e 100644 --- a/src/jnivm/internal/method.cpp +++ b/src/jnivm/internal/method.cpp @@ -335,4 +335,17 @@ DeclareTemplate(jdouble); DeclareTemplate(jchar); DeclareTemplate(jobject); DeclareTemplate(void); +#undef DeclareTemplate + +#define DeclareTemplate(T) template T jnivm::defaultVal(ENV* env, std::string signature) +DeclareTemplate(jboolean); +DeclareTemplate(jbyte); +DeclareTemplate(jshort); +DeclareTemplate(jint); +DeclareTemplate(jlong); +DeclareTemplate(jfloat); +DeclareTemplate(jdouble); +DeclareTemplate(jchar); +DeclareTemplate(jobject); +DeclareTemplate(void); #undef DeclareTemplate \ No newline at end of file diff --git a/src/jnivm/method.cpp b/src/jnivm/method.cpp index f41842c..b5b9b44 100644 --- a/src/jnivm/method.cpp +++ b/src/jnivm/method.cpp @@ -102,3 +102,15 @@ jvalue Method::jinvoke(jnivm::ENV &env, jobject obj, ...) { va_end(l); return ret; } + +#define DeclareTemplate(T) template jvalue toJValue(T val); +DeclareTemplate(jboolean); +DeclareTemplate(jbyte); +DeclareTemplate(jshort); +DeclareTemplate(jint); +DeclareTemplate(jlong); +DeclareTemplate(jfloat); +DeclareTemplate(jdouble); +DeclareTemplate(jchar); +DeclareTemplate(jobject); +#undef DeclareTemplate \ No newline at end of file diff --git a/src/jnivm/vm.cpp b/src/jnivm/vm.cpp index 1119808..f142a52 100644 --- a/src/jnivm/vm.cpp +++ b/src/jnivm/vm.cpp @@ -565,4 +565,7 @@ const JNINativeInterface &jnivm::VM::GetNativeInterfaceTemplate() { jnivm::VM *jnivm::VM::FromJavaVM(JavaVM *vm) { if(vm == nullptr || vm->functions->reserved0 == nullptr) throw std::runtime_error("Failed to get reference to jnivm::VM"); return static_cast(vm->functions->reserved0); -} \ No newline at end of file +} + +template JNINativeInterface jnivm::VM::GetNativeInterfaceTemplate(); +template JNINativeInterface jnivm::VM::GetNativeInterfaceTemplate(); \ No newline at end of file