diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2018-02-22 18:40:15 +0200 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2018-02-22 18:46:36 +0200 |
commit | c4f2f8449ad09301e5725f69b7374d958cc5dff8 (patch) | |
tree | 084c8e916e09cd0cbd16bd6732b0fbff217fc81b /src/libjvm-java.c | |
parent | 952720c8def83d62bc0d328c2cc46ead8254703d (diff) |
refactor commit
Diffstat (limited to 'src/libjvm-java.c')
-rw-r--r-- | src/libjvm-java.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libjvm-java.c b/src/libjvm-java.c index e87b9a4..a043a30 100644 --- a/src/libjvm-java.c +++ b/src/libjvm-java.c @@ -6,6 +6,8 @@ #include <err.h> #include <dlfcn.h> #include "jvm/jni.h" +#include "linker/dlfcn.h" +#include "wrapper/verbose.h" void java_lang_System_load(JNIEnv *env, jobject object, va_list args) @@ -13,16 +15,20 @@ java_lang_System_load(JNIEnv *env, jobject object, va_list args) assert(env && object); const char *lib = (*env)->GetStringUTFChars(env, va_arg(args, jstring), NULL); va_end(args); - printf("%s\n", lib); + verbose("%s", lib); void *handle = bionic_dlopen(lib, RTLD_NOW | RTLD_GLOBAL); assert(handle); - void* (*JNI_OnLoad)(void*, void*); - if ((JNI_OnLoad = bionic_dlsym(handle, "JNI_OnLoad"))) { + union { + void *ptr; + void* (*fun)(void*, void*); + } JNI_OnLoad; + + if ((JNI_OnLoad.ptr = bionic_dlsym(handle, "JNI_OnLoad"))) { JavaVM *vm; (*env)->GetJavaVM(env, &vm); - JNI_OnLoad(vm, NULL); + JNI_OnLoad.fun(vm, NULL); } } |