github.com/isyscore/isc-gobase@v1.5.3-0.20231218061332-cbc7451899e9/jvm/gojvm_c.h (about) 1 #ifndef __GOJVM_H__ 2 #define __GOJVM_H__ 3 4 #include <stdio.h> 5 #include <stdlib.h> 6 #include <jni.h> 7 #include <string.h> 8 #include <stdbool.h> 9 #include "gojvm_wrap.h" 10 11 JavaVM* createJvm(char* classPath, char* xms, char* xmx, char* xmn, char* xss); 12 int destroyJvm(JavaVM* jvm); 13 JNIEnv* attachJvm(JavaVM* jvm); 14 void detachJvm(JavaVM* jvm); 15 jclass findClass(JNIEnv* env, char* className); 16 jclass getObjectClass(JNIEnv* env, jobject obj); 17 jobject newJavaObject(JNIEnv* env, jclass clazz); 18 void freeJavaClassRef(JNIEnv* env, jclass clz); 19 void freeJavaObject(JNIEnv* env, jobject obj); 20 21 void callStaticVoidMethod(JNIEnv* env, jclass clazz, char* methodName, char* sig, int len, char** types, void** args); 22 jobject callStaticObjectMethod(JNIEnv *env, jclass clazz, char *methodName, char *sig, int len, char **types, void **args); 23 char* callStaticStringMethod(JNIEnv* env, jclass clazz, char* methodName, char* sig, int len, char** types, void** args); 24 int callStaticIntMethod(JNIEnv* env, jclass clazz, char* methodName, char* sig, int len, char** types, void** args); 25 long callStaticLongMethod(JNIEnv* env, jclass clazz, char* methodName, char* sig, int len, char** types, void** args); 26 short callStaticShortMethod(JNIEnv* env, jclass clazz, char* methodName, char* sig, int len, char** types, void** args); 27 unsigned char callStaticByteMethod(JNIEnv* env, jclass clazz, char* methodName, char* sig, int len, char** types, void** args); 28 float callStaticFloatMethod(JNIEnv* env, jclass clazz, char* methodName, char* sig, int len, char** types, void** args); 29 double callStaticDoubleMethod(JNIEnv* env, jclass clazz, char* methodName, char* sig, int len, char** types, void** args); 30 int callStaticBooleanMethod(JNIEnv* env, jclass clazz, char* methodName, char* sig, int len, char** types, void** args); 31 32 jobject getStaticObject(JNIEnv* env, jclass clazz, char* fieldName, char* sig); 33 void setStaticObject(JNIEnv* env, jclass clazz, char* fieldName, char* sig, jobject obj); 34 char* getStaticString(JNIEnv* env, jclass clazz, char* fieldName); 35 void setStaticString(JNIEnv* env, jclass clazz, char* fieldName, char* value); 36 int getStaticInt(JNIEnv* env, jclass clazz, char* fieldName); 37 void setStaticInt(JNIEnv* env, jclass clazz, char* fieldName, int value); 38 long getStaticLong(JNIEnv *env, jclass clazz, char *fieldName); 39 void setStaticLong(JNIEnv *env, jclass clazz, char *fieldName, long value); 40 short getStaticShort(JNIEnv *env, jclass clazz, char *fieldName); 41 void setStaticShort(JNIEnv *env, jclass clazz, char *fieldName, short value); 42 unsigned char getStaticByte(JNIEnv *env, jclass clazz, char *fieldName); 43 void setStaticByte(JNIEnv *env, jclass clazz, char *fieldName, unsigned char value); 44 float getStaticFloat(JNIEnv *env, jclass clazz, char *fieldName); 45 void setStaticFloat(JNIEnv *env, jclass clazz, char *fieldName, float value); 46 double getStaticDouble(JNIEnv *env, jclass clazz, char *fieldName); 47 void setStaticDouble(JNIEnv *env, jclass clazz, char *fieldName, double value); 48 int getStaticBoolean(JNIEnv *env, jclass clazz, char *fieldName); 49 void setStaticBoolean(JNIEnv *env, jclass clazz, char *fieldName, int value); 50 51 void callVoidMethod(JNIEnv *env, jclass clazz, jobject obj, char *methodName, char *sig, int len, char **types, void **args); 52 jobject callObjectMethod(JNIEnv *env, jclass clazz, jobject obj, char *methodName, char *sig, int len, char **types, void **args); 53 char *callStringMethod(JNIEnv *env, jclass clazz, jobject obj, char *methodName, char *sig, int len, char **types, void **args); 54 int callIntMethod(JNIEnv *env, jclass clazz, jobject obj, char *methodName, char *sig, int len, char **types, void **args); 55 long callLongMethod(JNIEnv *env, jclass clazz, jobject obj, char *methodName, char *sig, int len, char **types, void **args); 56 short callShortMethod(JNIEnv *env, jclass clazz, jobject obj, char *methodName, char *sig, int len, char **types, void **args); 57 unsigned char callByteMethod(JNIEnv *env, jclass clazz, jobject obj, char *methodName, char *sig, int len, char **types, void **args); 58 float callFloatMethod(JNIEnv *env, jclass clazz, jobject obj, char *methodName, char *sig, int len, char **types, void **args); 59 double callDoubleMethod(JNIEnv *env, jclass clazz, jobject obj, char *methodName, char *sig, int len, char **types, void **args); 60 int callBooleanMethod(JNIEnv *env, jclass clazz, jobject obj, char *methodName, char *sig, int len, char **types, void **args); 61 62 jobject getObjectObject(JNIEnv *env, jclass clazz, jobject obj, char *fieldName, char *sig); 63 void setObjectObject(JNIEnv *env, jclass clazz, jobject obj, char *fieldName, char *sig, jobject value); 64 char* getObjectString(JNIEnv* env, jclass clazz, jobject obj, char* fieldName); 65 void setObjectString(JNIEnv* env, jclass clazz, jobject obj, char* fieldName, char* value); 66 int getObjectInt(JNIEnv *env, jclass clazz, jobject obj, char *fieldName); 67 void setObjectInt(JNIEnv *env, jclass clazz, jobject obj, char *fieldName, int value); 68 long getObjectLong(JNIEnv *env, jclass clazz, jobject obj, char *fieldName); 69 void setObjectLong(JNIEnv *env, jclass clazz, jobject obj, char *fieldName, long value); 70 short getObjectShort(JNIEnv *env, jclass clazz, jobject obj, char *fieldName); 71 void setObjectShort(JNIEnv *env, jclass clazz, jobject obj, char *fieldName, short value); 72 unsigned char getObjectByte(JNIEnv *env, jclass clazz, jobject obj, char *fieldName); 73 void setObjectByte(JNIEnv *env, jclass clazz, jobject obj, char *fieldName, unsigned char value); 74 float getObjectFloat(JNIEnv *env, jclass clazz, jobject obj, char *fieldName); 75 void setObjectFloat(JNIEnv *env, jclass clazz, jobject obj, char *fieldName, float value); 76 double getObjectDouble(JNIEnv *env, jclass clazz, jobject obj, char *fieldName); 77 void setObjectDouble(JNIEnv *env, jclass clazz, jobject obj, char *fieldName, double value); 78 int getObjectBoolean(JNIEnv *env, jclass clazz, jobject obj, char *fieldName); 79 void setObjectBoolean(JNIEnv *env, jclass clazz, jobject obj, char *fieldName, int value); 80 81 #endif // __GOJVM_H__