📄 jni.h
字号:
/* jni.h Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free Software FoundationThis file is part of GNU Classpath.GNU Classpath is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version. GNU Classpath is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU Classpath; see the file COPYING. If not, write to theFree Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA02110-1301 USA.Linking this library statically or dynamically with other modules ismaking a combined work based on this library. Thus, the terms andconditions of the GNU General Public License cover the wholecombination.As a special exception, the copyright holders of this library give youpermission to link this library with independent modules to produce anexecutable, regardless of the license terms of these independentmodules, and to copy and distribute the resulting executable underterms of your choice, provided that you also meet, for each linkedindependent module, the terms and conditions of the license of thatmodule. An independent module is a module which is not derived fromor based on this library. If you modify this library, you may extendthis exception to your version of the library, but you are notobligated to do so. If you do not wish to do so, delete thisexception statement from your version. *//* Note: this file must be compilable by the C compiler (for now, assuming GNU C is ok). This means you must never use `//' comments, and all C++-specific code must be conditional on __cplusplus. */#ifndef _CLASSPATH_JNI_H#define _CLASSPATH_JNI_H/* We include <stdio.h> for compatibility with Sun's <jni.h>. */#include <stdio.h>#include <stdarg.h>#include "jni_md.h"/* The VM might define jobject and friends. */#ifndef _CLASSPATH_VM_JNI_TYPES_DEFINED# ifdef __cplusplus/* Define dummy classes and then define the JNI types as pointers. */struct __jobject {};struct __jclass : __jobject {};struct __jstring : __jobject {};struct __jthrowable : __jobject {};struct __jweak : __jobject {};struct __jarray : __jobject {};struct __jobjectArray : __jarray {};struct __jbyteArray : __jarray {};struct __jshortArray : __jarray {};struct __jintArray : __jarray {};struct __jlongArray : __jarray {};struct __jbooleanArray : __jarray {};struct __jcharArray : __jarray {};struct __jfloatArray : __jarray {};struct __jdoubleArray : __jarray {};typedef __jobject *jobject;typedef __jclass *jclass;typedef __jstring *jstring;typedef __jthrowable *jthrowable;typedef __jweak *jweak;typedef __jarray *jarray;typedef __jobjectArray *jobjectArray;typedef __jbyteArray *jbyteArray;typedef __jshortArray *jshortArray;typedef __jintArray *jintArray;typedef __jlongArray *jlongArray;typedef __jbooleanArray *jbooleanArray;typedef __jcharArray *jcharArray;typedef __jfloatArray *jfloatArray;typedef __jdoubleArray *jdoubleArray;#define JNI_TRUE true#define JNI_FALSE falsetypedef struct _Jv_JNIEnv JNIEnv;typedef struct _Jv_JavaVM JavaVM;# else /* __cplusplus *//* For C, simply define the class types as generic pointers. */typedef void *jobject;typedef jobject jclass;typedef jobject jstring;typedef jobject jthrowable;typedef jobject jweak;typedef jobject jarray;typedef jobject jobjectArray;typedef jobject jbyteArray;typedef jobject jshortArray;typedef jobject jintArray;typedef jobject jlongArray;typedef jobject jbooleanArray;typedef jobject jcharArray;typedef jobject jfloatArray;typedef jobject jdoubleArray;#define JNI_TRUE 1#define JNI_FALSE 0typedef const struct JNINativeInterface *JNIEnv;typedef const struct JNIInvokeInterface *JavaVM;# endif /* __cplusplus */#endif /* _CLASSPATH_VM_JNI_TYPES_DEFINED *//* * Before jni.h is #included within a typical JVM, the source code should * #define _JNI_VM_INTERNAL_TYPES_DEFINED and provide the real declarations * for 'jobject', 'jfieldID', 'jmethodID' and other implementation types. * If _JNI_VM_INTERNAL_TYPES_DEFINED is not defined, the following * declares the old versions of the types. */#ifndef _CLASSPATH_VM_INTERNAL_TYPES_DEFINEDstruct _jfieldID;struct _jmethodID;typedef struct _jfieldID *jfieldID;typedef struct _jmethodID *jmethodID;#endif /* Version numbers. */#define JNI_VERSION_1_1 0x00010001#define JNI_VERSION_1_2 0x00010002#define JNI_VERSION_1_4 0x00010004/* Used when releasing array elements. */#define JNI_COMMIT 1#define JNI_ABORT 2/* Error codes */#define JNI_OK 0#define JNI_ERR (-1)#define JNI_EDETACHED (-2)#define JNI_EVERSION (-3)#ifdef __cplusplusextern "C"{#endif /* __cplusplus *//* These functions might be defined in libraries which we load; the JNI implementation calls them at the appropriate times. */extern JNIEXPORT jint JNICALL JNI_OnLoad (JavaVM *, void *);extern JNIEXPORT void JNICALL JNI_OnUnload (JavaVM *, void *);/* This can be defined as JNIIMPORT or JNIEXPORT by the md file, depending on whether this is the implementation or a user. */#ifndef _CLASSPATH_JNIIMPEXP#define _CLASSPATH_JNIIMPEXP JNIIMPORT#endif/* These functions are called by user code to start using the invocation API. */extern _CLASSPATH_JNIIMPEXP jint JNICALLJNI_GetDefaultJavaVMInitArgs (void *);extern _CLASSPATH_JNIIMPEXP jint JNICALLJNI_CreateJavaVM (JavaVM **, void **, void *);extern _CLASSPATH_JNIIMPEXP jint JNICALLJNI_GetCreatedJavaVMs (JavaVM **, jsize, jsize *);#ifdef __cplusplus}#endif /* __cplusplus */typedef union jvalue{ jboolean z; jbyte b; jchar c; jshort s; jint i; jlong j; jfloat f; jdouble d; jobject l;} jvalue;/* This structure is used when registering native methods. */typedef struct{ char *name; char *signature; void *fnPtr; /* Sigh. */} JNINativeMethod;struct JNINativeInterface{ void *reserved0; void *reserved1; void *reserved2; void *reserved3; jint (JNICALL *GetVersion) (JNIEnv *); jclass (JNICALL *DefineClass) (JNIEnv *, const char *, jobject, const jbyte *, jsize); jclass (JNICALL *FindClass) (JNIEnv *, const char *); jmethodID (JNICALL *FromReflectedMethod) (JNIEnv *, jobject); jfieldID (JNICALL *FromReflectedField) (JNIEnv *, jobject); jobject (JNICALL *ToReflectedMethod) (JNIEnv *, jclass, jmethodID, jboolean); jclass (JNICALL *GetSuperclass) (JNIEnv *, jclass); jboolean (JNICALL *IsAssignableFrom) (JNIEnv *, jclass, jclass); jobject (JNICALL *ToReflectedField) (JNIEnv *, jclass, jfieldID, jboolean); jint (JNICALL *Throw) (JNIEnv *, jthrowable); jint (JNICALL *ThrowNew) (JNIEnv *, jclass, const char *); jthrowable (JNICALL *ExceptionOccurred) (JNIEnv *); void (JNICALL *ExceptionDescribe) (JNIEnv *); void (JNICALL *ExceptionClear) (JNIEnv *); void (JNICALL *FatalError) (JNIEnv *, const char *); jint (JNICALL *PushLocalFrame) (JNIEnv *, jint); jobject (JNICALL *PopLocalFrame) (JNIEnv *, jobject); jobject (JNICALL *NewGlobalRef) (JNIEnv *, jobject); void (JNICALL *DeleteGlobalRef) (JNIEnv *, jobject); void (JNICALL *DeleteLocalRef) (JNIEnv *, jobject); jboolean (JNICALL *IsSameObject) (JNIEnv *, jobject, jobject); jobject (JNICALL *NewLocalRef) (JNIEnv *, jobject); jint (JNICALL *EnsureLocalCapacity) (JNIEnv *, jint); jobject (JNICALL *AllocObject) (JNIEnv *, jclass); jobject (JNICALL *NewObject) (JNIEnv *, jclass, jmethodID, ...); jobject (JNICALL *NewObjectV) (JNIEnv *, jclass, jmethodID, va_list); jobject (JNICALL *NewObjectA) (JNIEnv *, jclass, jmethodID, jvalue *); jclass (JNICALL *GetObjectClass) (JNIEnv *, jobject); jboolean (JNICALL *IsInstanceOf) (JNIEnv *, jobject, jclass); jmethodID (JNICALL *GetMethodID) (JNIEnv *, jclass, const char *, const char *); jobject (JNICALL *CallObjectMethod) (JNIEnv *, jobject, jmethodID, ...); jobject (JNICALL *CallObjectMethodV) (JNIEnv *, jobject, jmethodID, va_list); jobject (JNICALL *CallObjectMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); jboolean (JNICALL *CallBooleanMethod) (JNIEnv *, jobject, jmethodID, ...); jboolean (JNICALL *CallBooleanMethodV) (JNIEnv *, jobject, jmethodID, va_list); jboolean (JNICALL *CallBooleanMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); jbyte (JNICALL *CallByteMethod) (JNIEnv *, jobject, jmethodID, ...); jbyte (JNICALL *CallByteMethodV) (JNIEnv *, jobject, jmethodID, va_list); jbyte (JNICALL *CallByteMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); jchar (JNICALL *CallCharMethod) (JNIEnv *, jobject, jmethodID, ...); jchar (JNICALL *CallCharMethodV) (JNIEnv *, jobject, jmethodID, va_list); jchar (JNICALL *CallCharMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); jshort (JNICALL *CallShortMethod) (JNIEnv *, jobject, jmethodID, ...); jshort (JNICALL *CallShortMethodV) (JNIEnv *, jobject, jmethodID, va_list); jshort (JNICALL *CallShortMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); jint (JNICALL *CallIntMethod) (JNIEnv *, jobject, jmethodID, ...); jint (JNICALL *CallIntMethodV) (JNIEnv *, jobject, jmethodID, va_list); jint (JNICALL *CallIntMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); jlong (JNICALL *CallLongMethod) (JNIEnv *, jobject, jmethodID, ...); jlong (JNICALL *CallLongMethodV) (JNIEnv *, jobject, jmethodID, va_list); jlong (JNICALL *CallLongMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); jfloat (JNICALL *CallFloatMethod) (JNIEnv *, jobject, jmethodID, ...); jfloat (JNICALL *CallFloatMethodV) (JNIEnv *, jobject, jmethodID, va_list); jfloat (JNICALL *CallFloatMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); jdouble (JNICALL *CallDoubleMethod) (JNIEnv *, jobject, jmethodID, ...); jdouble (JNICALL *CallDoubleMethodV) (JNIEnv *, jobject, jmethodID, va_list); jdouble (JNICALL *CallDoubleMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); void (JNICALL *CallVoidMethod) (JNIEnv *, jobject, jmethodID, ...); void (JNICALL *CallVoidMethodV) (JNIEnv *, jobject, jmethodID, va_list); void (JNICALL *CallVoidMethodA) (JNIEnv *, jobject, jmethodID, jvalue *); jobject (JNICALL *CallNonvirtualObjectMethod) (JNIEnv *, jobject, jclass, jmethodID, ...); jobject (JNICALL *CallNonvirtualObjectMethodV) (JNIEnv *, jobject, jclass,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -