Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Add the ability to get the JavaVM #414

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions support-lib/jni/djinni_support.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ void jniShutdown() {
g_cachedJVM = nullptr;
}

JavaVM * jniGetVM() {
return g_cachedJVM;
}

JNIEnv * jniGetThreadEnv() {
assert(g_cachedJVM);
JNIEnv * env = nullptr;
Expand Down
7 changes: 7 additions & 0 deletions support-lib/jni/djinni_support.hpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ namespace djinni {
void jniInit(JavaVM * jvm);
void jniShutdown();

/*
* Get the JavaVM which was registered in the onload for e.g. forwarding to other libraries
*
*/

JavaVM * jniGetVM();

/*
* Get the JNIEnv for the invoking thread. Should only be called on Java-created threads.
*/
Expand Down