summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-02-19 13:33:53 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2018-02-19 13:33:53 +0200
commit09fc4ea761b6b774a6423bdfd92049be78e32a49 (patch)
tree04c467919f057effb36352d7531693239e46e337 /src
parent535779b6ff5cd21590e5ed3aff3c9ae4c785e34d (diff)
jvm: implement more java apis
Diffstat (limited to 'src')
-rw-r--r--src/jvm/jvm.c7
-rw-r--r--src/libjvm-android.c6
-rw-r--r--src/libjvm-java.c7
3 files changed, 14 insertions, 6 deletions
diff --git a/src/jvm/jvm.c b/src/jvm/jvm.c
index 130c017..72529df 100644
--- a/src/jvm/jvm.c
+++ b/src/jvm/jvm.c
@@ -769,9 +769,10 @@ static void
JNIEnv_CallVoidMethodV(JNIEnv* p0, jobject p1, jmethodID p2, va_list p3)
{
assert(p0 && p1 && p2);
- struct jvm *jvm = jnienv_get_jvm(p0);
- struct jvm_method *method = &jvm_get_object(jvm, p2)->method;
- printf("%s::%s\n", jvm_get_object(jvm, method->klass)->klass.name.data, method->name.data);
+ char symbol[255];
+ jvm_form_symbol(jnienv_get_jvm(p0), p2, symbol, sizeof(symbol));
+ void (*fun)(JNIEnv*, jobject, va_list) = create_wrapper(symbol, dlsym(RTLD_DEFAULT, symbol));
+ fun(p0, p1, p3);
}
static void
diff --git a/src/libjvm-android.c b/src/libjvm-android.c
index 7cece38..d9fff44 100644
--- a/src/libjvm-android.c
+++ b/src/libjvm-android.c
@@ -46,3 +46,9 @@ android_content_SharedPreferences_Editor_putInt(JNIEnv *env, jobject object, va_
va_end(args);
return object;
}
+
+void
+android_content_SharedPreferences_Editor_apply(JNIEnv *env, jobject object, va_list args)
+{
+ assert(env && object);
+}
diff --git a/src/libjvm-java.c b/src/libjvm-java.c
index 64dee13..25e93c0 100644
--- a/src/libjvm-java.c
+++ b/src/libjvm-java.c
@@ -22,10 +22,11 @@ jobject
java_lang_ClassLoader_findLibrary(JNIEnv *env, jobject object, va_list args)
{
assert(env && object);
- jstring str = va_arg(args, jstring);
- printf("%s\n", (*env)->GetStringUTFChars(env, str, NULL));
+ char lib[255];
+ snprintf(lib, sizeof(lib), "lib%s.so", (*env)->GetStringUTFChars(env, va_arg(args, jstring), NULL));
va_end(args);
- return NULL;
+ printf("%s\n", lib);
+ return (*env)->NewStringUTF(env, lib);
}
jobject