summaryrefslogtreecommitdiff
path: root/src/fakejvm/jvm.h
blob: f7e9d6c46d95695a8c3fd793e7fb0d823bddf5d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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);