From 532c53c39c741e09377517ad9845fb3b89861a40 Mon Sep 17 00:00:00 2001 From: bl1nc Date: Mon, 29 Jan 2024 19:36:44 +0600 Subject: [PATCH] get_jni_java_vm function --- jnius/jnius.pyx | 2 +- jnius/jnius_env.pxi | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/jnius/jnius.pyx b/jnius/jnius.pyx index df4644f1..c784ff26 100644 --- a/jnius/jnius.pyx +++ b/jnius/jnius.pyx @@ -88,7 +88,7 @@ Python:: __all__ = ('JavaObject', 'JavaClass', 'JavaMethod', 'JavaField', 'JavaStaticMethod', 'JavaStaticField', 'JavaMultipleMethod', 'MetaJavaBase', 'MetaJavaClass', 'JavaException', 'cast', - 'find_javaclass', 'PythonJavaClass', 'java_method', 'detach') + 'find_javaclass', 'PythonJavaClass', 'java_method', 'detach', 'get_jni_java_vm') from libc.stdlib cimport malloc, free from functools import partial diff --git a/jnius/jnius_env.pxi b/jnius/jnius_env.pxi index 336ab0ec..1ae686e8 100644 --- a/jnius/jnius_env.pxi +++ b/jnius/jnius_env.pxi @@ -1,3 +1,5 @@ +from libc.stdint cimport intptr_t + cdef JNIEnv *default_env = NULL @@ -23,3 +25,5 @@ cdef JNIEnv *get_jnienv() except NULL: def detach(): jvm[0].DetachCurrentThread(jvm) +def get_jni_java_vm(): + return default_env, jvm