summaryrefslogtreecommitdiff
path: root/src/fakejvm/jvm.h
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-02-17 23:04:55 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2018-02-17 23:04:55 +0200
commitf378a448336d4fb3547b53c0712fd7307fc0ba3a (patch)
treeec1340379c497a1009384b2eb9035f5fc7be53d8 /src/fakejvm/jvm.h
parent33a9a63787154facfdaddaf719e727947c159800 (diff)
Add fake jvm
Diffstat (limited to 'src/fakejvm/jvm.h')
-rw-r--r--src/fakejvm/jvm.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/fakejvm/jvm.h b/src/fakejvm/jvm.h
new file mode 100644
index 0000000..f7e9d6c
--- /dev/null
+++ b/src/fakejvm/jvm.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#include "jni.h"
+
+struct jvm_native_method {
+ char *klass;
+ char *method;
+ void *function;
+};
+
+struct jvm {
+ struct jvm_native_method methods[255];
+
+ struct JNINativeInterface native;
+ struct JNIInvokeInterface invoke;
+
+ // JNI's api is weird.. pointer to a reference of a struct, OK!
+ // Developers have to dereference these pointers to call methods from an ... reference.
+ // NOTE: These are pointers, and JNI interface passes pointers to these pointers!
+ JNIEnv env; // points to native
+ JavaVM vm; // points to invoke
+};
+
+void
+jvm_init(struct jvm *jvm);