diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2018-02-20 08:44:42 +0200 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2018-02-20 08:44:42 +0200 |
commit | a0b1835621f7d3ed9fc0e142550cf29720615096 (patch) | |
tree | 5b8c903190c75f10e1753c1ec50a446c2192ceb0 /src/libjvm-java.c | |
parent | a08dd25eb79ed44ae06db2b95d4b44d77ea68110 (diff) |
Messy commit of hacks and implementations
Diffstat (limited to 'src/libjvm-java.c')
-rw-r--r-- | src/libjvm-java.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/libjvm-java.c b/src/libjvm-java.c index ed2b6ce..e87b9a4 100644 --- a/src/libjvm-java.c +++ b/src/libjvm-java.c @@ -14,8 +14,16 @@ java_lang_System_load(JNIEnv *env, jobject object, va_list args) const char *lib = (*env)->GetStringUTFChars(env, va_arg(args, jstring), NULL); va_end(args); printf("%s\n", lib); - // FIXME: should handle loading properly - // bionic_dlopen(lib, RTLD_NOW | RTLD_GLOBAL); + + void *handle = bionic_dlopen(lib, RTLD_NOW | RTLD_GLOBAL); + assert(handle); + + void* (*JNI_OnLoad)(void*, void*); + if ((JNI_OnLoad = bionic_dlsym(handle, "JNI_OnLoad"))) { + JavaVM *vm; + (*env)->GetJavaVM(env, &vm); + JNI_OnLoad(vm, NULL); + } } jclass @@ -42,7 +50,6 @@ java_lang_ClassLoader_findLibrary(JNIEnv *env, jobject object, va_list args) char lib[255]; snprintf(lib, sizeof(lib), "lib%s.so", (*env)->GetStringUTFChars(env, va_arg(args, jstring), NULL)); va_end(args); - printf("%s\n", lib); return (*env)->NewStringUTF(env, lib); } @@ -68,3 +75,11 @@ java_util_Iterator_hasNext(JNIEnv *env, jobject object, va_list args) assert(env && object); return false; } + +jstring +java_io_File_getPath(JNIEnv *env, jobject object, va_list args) +{ + assert(env && object); + // FIXME: see comment on `android_content_Context_getExternalFilesDir` + return (*env)->NewStringUTF(env, "tmp"); +} |