public JNIResult UnregisterNatives(Class clazz) { JNIResult natives = unregisterNatives.Invoke(envPtr, clazz.jvmHandle); ExceptionTest(); return(natives); }
public JNIResult RegisterNatives(Class clazz, JNINativeMethod *methods, int nMethods) { JNIResult natives = registerNatives.Invoke(envPtr, clazz.jvmHandle, methods, nMethods); ExceptionTest(); return(natives); }
public JNIResult GetEnv(out JNIEnv penv, int version) { IntPtr env; JNIResult result = getEnv.Invoke(native, out env, version); penv = new JNIEnv(env); return(result); }
public static unsafe void Unregister(Class jvmProxy, JNIEnv env) { JNIResult res = env.UnregisterNatives(jvmProxy); if (res != JNIResult.JNI_OK) { throw new JNIException("Can't unbind native methods to class " + jvmProxy); } }
public static unsafe void Unregister(JniHandle clazz, JNIEnv env) { JNIResult res = env.UnregisterNatives(clazz); if (res != JNIResult.JNI_OK) { throw new JNIException("Can't unbind native methods to class."); } }
public static JNIEnv GetEnvNoThrow(JavaVM vm) { if (threadJNIEnv == null) { JNIResult result = vm.AttachCurrentThreadAsDaemon(out threadJNIEnv, null); if (result != JNIResult.JNI_OK) { return(null); } } return(threadJNIEnv); }
public static JNIEnv GetEnvForVm(JavaVM vm) { if (threadJNIEnv == null) { JNIResult result = vm.AttachCurrentThreadAsDaemon(out threadJNIEnv, null); if (result != JNIResult.JNI_OK) { throw new JNIException("AttachCurrentThreadAsDaemon failed: " + result); } } return(threadJNIEnv); }
public static void DetachCurrentThread() { if (threadJNIEnv != null) { JNIResult result = defaultVM.DetachCurrentThread(); if (result != JNIResult.JNI_OK) { throw new JNIException("DetachCurrentThread failed: " + result); } threadJNIEnv = null; } }
public JNIResult GetEnv(out JNIEnv penv, int version) { if (getEnv == null) { MethodWrapper.GetDelegateForFunctionPointer(functions.GetEnv, ref getEnv); } IntPtr env; JNIResult result = getEnv.Invoke(native, out env, version); penv = new JNIEnv(env); return(result); }
public static unsafe void Register(List <JNINativeMethod> registrations, Class jvmProxy, JNIEnv env) { JNINativeMethod[] methods = registrations.ToArray(); fixed(JNINativeMethod *m = &(methods[0])) { JNIResult res = env.RegisterNatives(jvmProxy, m, methods.Length); if (res != JNIResult.JNI_OK) { throw new JNIException("Can't bind native methods to class " + jvmProxy + " is it in system classloader ?"); } } }