Skip to content

Instantly share code, notes, and snippets.

@Kr328
Last active February 27, 2023 08:31
Show Gist options
  • Save Kr328/52b8076ccfa58a3e1b9d05705f6a2bb9 to your computer and use it in GitHub Desktop.
Save Kr328/52b8076ccfa58a3e1b9d05705f6a2bb9 to your computer and use it in GitHub Desktop.
A jni stubs in ziglang.
const std = @import("std");
// TODO: replace with std.builtin.VaList
pub const va_list = [*c]extern struct {
gp_offset: c_uint,
fp_offset: c_uint,
overflow_arg_area: ?*anyopaque,
reg_save_area: ?*anyopaque,
};
pub const jint = i32;
pub const jlong = i64;
pub const jbyte = i8;
pub const jboolean = u8;
pub const jchar = u16;
pub const jshort = i16;
pub const jfloat = f32;
pub const jdouble = f64;
pub const jsize = jint;
pub const jobject = ?*opaque {};
pub const jclass = jobject;
pub const jthrowable = jobject;
pub const jstring = jobject;
pub const jarray = jobject;
pub const jbooleanArray = jarray;
pub const jbyteArray = jarray;
pub const jcharArray = jarray;
pub const jshortArray = jarray;
pub const jintArray = jarray;
pub const jlongArray = jarray;
pub const jfloatArray = jarray;
pub const jdoubleArray = jarray;
pub const jobjectArray = jarray;
pub const jvalue = extern union {
z: jboolean,
b: jbyte,
c: jchar,
s: jshort,
i: jint,
j: jlong,
f: jfloat,
d: jdouble,
l: jobject,
};
pub const jweak = jobject;
pub const jfieldID = ?*opaque {};
pub const jmethodID = ?*opaque {};
pub const jobjectRefType = c_uint;
pub const JNIInvalidRefType: c_uint = 0;
pub const JNILocalRefType: c_uint = 1;
pub const JNIGlobalRefType: c_uint = 2;
pub const JNIWeakGlobalRefType: c_uint = 3;
pub const JNINativeMethod = extern struct {
name: [*c]const u8,
signature: [*c]const u8,
fnPtr: *anyopaque,
};
pub const JNIInvokeInterface = extern struct {
reserved0: ?*anyopaque,
reserved1: ?*anyopaque,
reserved2: ?*anyopaque,
DestroyJavaVM: *const fn (*JavaVM) callconv(.C) jint,
AttachCurrentThread: *const fn (*JavaVM, *?*JNIEnv, ?*anyopaque) callconv(.C) jint,
DetachCurrentThread: *const fn (*JavaVM) callconv(.C) jint,
GetEnv: *const fn (*JavaVM, *?*JNIEnv, jint) callconv(.C) jint,
AttachCurrentThreadAsDaemon: *const fn (*JavaVM, *?*JNIEnv, ?*anyopaque) callconv(.C) jint,
};
pub const JavaVM = *const JNIInvokeInterface;
pub const JNINativeInterface = extern struct {
reserved0: ?*anyopaque,
reserved1: ?*anyopaque,
reserved2: ?*anyopaque,
reserved3: ?*anyopaque,
GetVersion: *const fn (*JNIEnv) callconv(.C) jint,
DefineClass: *const fn (*JNIEnv, [*c]const u8, jobject, [*c]const jbyte, jsize) callconv(.C) jclass,
FindClass: *const fn (*JNIEnv, [*c]const u8) callconv(.C) jclass,
FromReflectedMethod: *const fn (*JNIEnv, jobject) callconv(.C) jmethodID,
FromReflectedField: *const fn (*JNIEnv, jobject) callconv(.C) jfieldID,
ToReflectedMethod: *const fn (*JNIEnv, jclass, jmethodID, jboolean) callconv(.C) jobject,
GetSuperclass: *const fn (*JNIEnv, jclass) callconv(.C) jclass,
IsAssignableFrom: *const fn (*JNIEnv, jclass, jclass) callconv(.C) jboolean,
ToReflectedField: *const fn (*JNIEnv, jclass, jfieldID, jboolean) callconv(.C) jobject,
Throw: *const fn (*JNIEnv, jthrowable) callconv(.C) jint,
ThrowNew: *const fn (*JNIEnv, jclass, [*c]const u8) callconv(.C) jint,
ExceptionOccurred: *const fn (*JNIEnv) callconv(.C) jthrowable,
ExceptionDescribe: *const fn (*JNIEnv) callconv(.C) void,
ExceptionClear: *const fn (*JNIEnv) callconv(.C) void,
FatalError: *const fn (*JNIEnv, [*c]const u8) callconv(.C) void,
PushLocalFrame: *const fn (*JNIEnv, jint) callconv(.C) jint,
PopLocalFrame: *const fn (*JNIEnv, jobject) callconv(.C) jobject,
NewGlobalRef: *const fn (*JNIEnv, jobject) callconv(.C) jobject,
DeleteGlobalRef: *const fn (*JNIEnv, jobject) callconv(.C) void,
DeleteLocalRef: *const fn (*JNIEnv, jobject) callconv(.C) void,
IsSameObject: *const fn (*JNIEnv, jobject, jobject) callconv(.C) jboolean,
NewLocalRef: *const fn (*JNIEnv, jobject) callconv(.C) jobject,
EnsureLocalCapacity: *const fn (*JNIEnv, jint) callconv(.C) jint,
AllocObject: *const fn (*JNIEnv, jclass) callconv(.C) jobject,
NewObject: *const fn (*JNIEnv, jclass, jmethodID, ...) callconv(.C) jobject,
NewObjectV: *const fn (*JNIEnv, jclass, jmethodID, va_list) callconv(.C) jobject,
NewObjectA: *const fn (*JNIEnv, jclass, jmethodID, [*c]const jvalue) callconv(.C) jobject,
GetObjectClass: *const fn (*JNIEnv, jobject) callconv(.C) jclass,
IsInstanceOf: *const fn (*JNIEnv, jobject, jclass) callconv(.C) jboolean,
GetMethodID: *const fn (*JNIEnv, jclass, [*c]const u8, [*c]const u8) callconv(.C) jmethodID,
CallObjectMethod: *const fn (*JNIEnv, jobject, jmethodID, ...) callconv(.C) jobject,
CallObjectMethodV: *const fn (*JNIEnv, jobject, jmethodID, va_list) callconv(.C) jobject,
CallObjectMethodA: *const fn (*JNIEnv, jobject, jmethodID, [*c]const jvalue) callconv(.C) jobject,
CallBooleanMethod: *const fn (*JNIEnv, jobject, jmethodID, ...) callconv(.C) jboolean,
CallBooleanMethodV: *const fn (*JNIEnv, jobject, jmethodID, va_list) callconv(.C) jboolean,
CallBooleanMethodA: *const fn (*JNIEnv, jobject, jmethodID, [*c]const jvalue) callconv(.C) jboolean,
CallByteMethod: *const fn (*JNIEnv, jobject, jmethodID, ...) callconv(.C) jbyte,
CallByteMethodV: *const fn (*JNIEnv, jobject, jmethodID, va_list) callconv(.C) jbyte,
CallByteMethodA: *const fn (*JNIEnv, jobject, jmethodID, [*c]const jvalue) callconv(.C) jbyte,
CallCharMethod: *const fn (*JNIEnv, jobject, jmethodID, ...) callconv(.C) jchar,
CallCharMethodV: *const fn (*JNIEnv, jobject, jmethodID, va_list) callconv(.C) jchar,
CallCharMethodA: *const fn (*JNIEnv, jobject, jmethodID, [*c]const jvalue) callconv(.C) jchar,
CallShortMethod: *const fn (*JNIEnv, jobject, jmethodID, ...) callconv(.C) jshort,
CallShortMethodV: *const fn (*JNIEnv, jobject, jmethodID, va_list) callconv(.C) jshort,
CallShortMethodA: *const fn (*JNIEnv, jobject, jmethodID, [*c]const jvalue) callconv(.C) jshort,
CallIntMethod: *const fn (*JNIEnv, jobject, jmethodID, ...) callconv(.C) jint,
CallIntMethodV: *const fn (*JNIEnv, jobject, jmethodID, va_list) callconv(.C) jint,
CallIntMethodA: *const fn (*JNIEnv, jobject, jmethodID, [*c]const jvalue) callconv(.C) jint,
CallLongMethod: *const fn (*JNIEnv, jobject, jmethodID, ...) callconv(.C) jlong,
CallLongMethodV: *const fn (*JNIEnv, jobject, jmethodID, va_list) callconv(.C) jlong,
CallLongMethodA: *const fn (*JNIEnv, jobject, jmethodID, [*c]const jvalue) callconv(.C) jlong,
CallFloatMethod: *const fn (*JNIEnv, jobject, jmethodID, ...) callconv(.C) jfloat,
CallFloatMethodV: *const fn (*JNIEnv, jobject, jmethodID, va_list) callconv(.C) jfloat,
CallFloatMethodA: *const fn (*JNIEnv, jobject, jmethodID, [*c]const jvalue) callconv(.C) jfloat,
CallDoubleMethod: *const fn (*JNIEnv, jobject, jmethodID, ...) callconv(.C) jdouble,
CallDoubleMethodV: *const fn (*JNIEnv, jobject, jmethodID, va_list) callconv(.C) jdouble,
CallDoubleMethodA: *const fn (*JNIEnv, jobject, jmethodID, [*c]const jvalue) callconv(.C) jdouble,
CallVoidMethod: *const fn (*JNIEnv, jobject, jmethodID, ...) callconv(.C) void,
CallVoidMethodV: *const fn (*JNIEnv, jobject, jmethodID, va_list) callconv(.C) void,
CallVoidMethodA: *const fn (*JNIEnv, jobject, jmethodID, [*c]const jvalue) callconv(.C) void,
CallNonvirtualObjectMethod: *const fn (*JNIEnv, jobject, jclass, jmethodID, ...) callconv(.C) jobject,
CallNonvirtualObjectMethodV: *const fn (*JNIEnv, jobject, jclass, jmethodID, va_list) callconv(.C) jobject,
CallNonvirtualObjectMethodA: *const fn (*JNIEnv, jobject, jclass, jmethodID, [*c]const jvalue) callconv(.C) jobject,
CallNonvirtualBooleanMethod: *const fn (*JNIEnv, jobject, jclass, jmethodID, ...) callconv(.C) jboolean,
CallNonvirtualBooleanMethodV: *const fn (*JNIEnv, jobject, jclass, jmethodID, va_list) callconv(.C) jboolean,
CallNonvirtualBooleanMethodA: *const fn (*JNIEnv, jobject, jclass, jmethodID, [*c]const jvalue) callconv(.C) jboolean,
CallNonvirtualByteMethod: *const fn (*JNIEnv, jobject, jclass, jmethodID, ...) callconv(.C) jbyte,
CallNonvirtualByteMethodV: *const fn (*JNIEnv, jobject, jclass, jmethodID, va_list) callconv(.C) jbyte,
CallNonvirtualByteMethodA: *const fn (*JNIEnv, jobject, jclass, jmethodID, [*c]const jvalue) callconv(.C) jbyte,
CallNonvirtualCharMethod: *const fn (*JNIEnv, jobject, jclass, jmethodID, ...) callconv(.C) jchar,
CallNonvirtualCharMethodV: *const fn (*JNIEnv, jobject, jclass, jmethodID, va_list) callconv(.C) jchar,
CallNonvirtualCharMethodA: *const fn (*JNIEnv, jobject, jclass, jmethodID, [*c]const jvalue) callconv(.C) jchar,
CallNonvirtualShortMethod: *const fn (*JNIEnv, jobject, jclass, jmethodID, ...) callconv(.C) jshort,
CallNonvirtualShortMethodV: *const fn (*JNIEnv, jobject, jclass, jmethodID, va_list) callconv(.C) jshort,
CallNonvirtualShortMethodA: *const fn (*JNIEnv, jobject, jclass, jmethodID, [*c]const jvalue) callconv(.C) jshort,
CallNonvirtualIntMethod: *const fn (*JNIEnv, jobject, jclass, jmethodID, ...) callconv(.C) jint,
CallNonvirtualIntMethodV: *const fn (*JNIEnv, jobject, jclass, jmethodID, va_list) callconv(.C) jint,
CallNonvirtualIntMethodA: *const fn (*JNIEnv, jobject, jclass, jmethodID, [*c]const jvalue) callconv(.C) jint,
CallNonvirtualLongMethod: *const fn (*JNIEnv, jobject, jclass, jmethodID, ...) callconv(.C) jlong,
CallNonvirtualLongMethodV: *const fn (*JNIEnv, jobject, jclass, jmethodID, va_list) callconv(.C) jlong,
CallNonvirtualLongMethodA: *const fn (*JNIEnv, jobject, jclass, jmethodID, [*c]const jvalue) callconv(.C) jlong,
CallNonvirtualFloatMethod: *const fn (*JNIEnv, jobject, jclass, jmethodID, ...) callconv(.C) jfloat,
CallNonvirtualFloatMethodV: *const fn (*JNIEnv, jobject, jclass, jmethodID, va_list) callconv(.C) jfloat,
CallNonvirtualFloatMethodA: *const fn (*JNIEnv, jobject, jclass, jmethodID, [*c]const jvalue) callconv(.C) jfloat,
CallNonvirtualDoubleMethod: *const fn (*JNIEnv, jobject, jclass, jmethodID, ...) callconv(.C) jdouble,
CallNonvirtualDoubleMethodV: *const fn (*JNIEnv, jobject, jclass, jmethodID, va_list) callconv(.C) jdouble,
CallNonvirtualDoubleMethodA: *const fn (*JNIEnv, jobject, jclass, jmethodID, [*c]const jvalue) callconv(.C) jdouble,
CallNonvirtualVoidMethod: *const fn (*JNIEnv, jobject, jclass, jmethodID, ...) callconv(.C) void,
CallNonvirtualVoidMethodV: *const fn (*JNIEnv, jobject, jclass, jmethodID, va_list) callconv(.C) void,
CallNonvirtualVoidMethodA: *const fn (*JNIEnv, jobject, jclass, jmethodID, [*c]const jvalue) callconv(.C) void,
GetFieldID: *const fn (*JNIEnv, jclass, [*c]const u8, [*c]const u8) callconv(.C) jfieldID,
GetObjectField: *const fn (*JNIEnv, jobject, jfieldID) callconv(.C) jobject,
GetBooleanField: *const fn (*JNIEnv, jobject, jfieldID) callconv(.C) jboolean,
GetByteField: *const fn (*JNIEnv, jobject, jfieldID) callconv(.C) jbyte,
GetCharField: *const fn (*JNIEnv, jobject, jfieldID) callconv(.C) jchar,
GetShortField: *const fn (*JNIEnv, jobject, jfieldID) callconv(.C) jshort,
GetIntField: *const fn (*JNIEnv, jobject, jfieldID) callconv(.C) jint,
GetLongField: *const fn (*JNIEnv, jobject, jfieldID) callconv(.C) jlong,
GetFloatField: *const fn (*JNIEnv, jobject, jfieldID) callconv(.C) jfloat,
GetDoubleField: *const fn (*JNIEnv, jobject, jfieldID) callconv(.C) jdouble,
SetObjectField: *const fn (*JNIEnv, jobject, jfieldID, jobject) callconv(.C) void,
SetBooleanField: *const fn (*JNIEnv, jobject, jfieldID, jboolean) callconv(.C) void,
SetByteField: *const fn (*JNIEnv, jobject, jfieldID, jbyte) callconv(.C) void,
SetCharField: *const fn (*JNIEnv, jobject, jfieldID, jchar) callconv(.C) void,
SetShortField: *const fn (*JNIEnv, jobject, jfieldID, jshort) callconv(.C) void,
SetIntField: *const fn (*JNIEnv, jobject, jfieldID, jint) callconv(.C) void,
SetLongField: *const fn (*JNIEnv, jobject, jfieldID, jlong) callconv(.C) void,
SetFloatField: *const fn (*JNIEnv, jobject, jfieldID, jfloat) callconv(.C) void,
SetDoubleField: *const fn (*JNIEnv, jobject, jfieldID, jdouble) callconv(.C) void,
GetStaticMethodID: *const fn (*JNIEnv, jclass, [*c]const u8, [*c]const u8) callconv(.C) jmethodID,
CallStaticObjectMethod: *const fn (*JNIEnv, jclass, jmethodID, ...) callconv(.C) jobject,
CallStaticObjectMethodV: *const fn (*JNIEnv, jclass, jmethodID, va_list) callconv(.C) jobject,
CallStaticObjectMethodA: *const fn (*JNIEnv, jclass, jmethodID, [*c]const jvalue) callconv(.C) jobject,
CallStaticBooleanMethod: *const fn (*JNIEnv, jclass, jmethodID, ...) callconv(.C) jboolean,
CallStaticBooleanMethodV: *const fn (*JNIEnv, jclass, jmethodID, va_list) callconv(.C) jboolean,
CallStaticBooleanMethodA: *const fn (*JNIEnv, jclass, jmethodID, [*c]const jvalue) callconv(.C) jboolean,
CallStaticByteMethod: *const fn (*JNIEnv, jclass, jmethodID, ...) callconv(.C) jbyte,
CallStaticByteMethodV: *const fn (*JNIEnv, jclass, jmethodID, va_list) callconv(.C) jbyte,
CallStaticByteMethodA: *const fn (*JNIEnv, jclass, jmethodID, [*c]const jvalue) callconv(.C) jbyte,
CallStaticCharMethod: *const fn (*JNIEnv, jclass, jmethodID, ...) callconv(.C) jchar,
CallStaticCharMethodV: *const fn (*JNIEnv, jclass, jmethodID, va_list) callconv(.C) jchar,
CallStaticCharMethodA: *const fn (*JNIEnv, jclass, jmethodID, [*c]const jvalue) callconv(.C) jchar,
CallStaticShortMethod: *const fn (*JNIEnv, jclass, jmethodID, ...) callconv(.C) jshort,
CallStaticShortMethodV: *const fn (*JNIEnv, jclass, jmethodID, va_list) callconv(.C) jshort,
CallStaticShortMethodA: *const fn (*JNIEnv, jclass, jmethodID, [*c]const jvalue) callconv(.C) jshort,
CallStaticIntMethod: *const fn (*JNIEnv, jclass, jmethodID, ...) callconv(.C) jint,
CallStaticIntMethodV: *const fn (*JNIEnv, jclass, jmethodID, va_list) callconv(.C) jint,
CallStaticIntMethodA: *const fn (*JNIEnv, jclass, jmethodID, [*c]const jvalue) callconv(.C) jint,
CallStaticLongMethod: *const fn (*JNIEnv, jclass, jmethodID, ...) callconv(.C) jlong,
CallStaticLongMethodV: *const fn (*JNIEnv, jclass, jmethodID, va_list) callconv(.C) jlong,
CallStaticLongMethodA: *const fn (*JNIEnv, jclass, jmethodID, [*c]const jvalue) callconv(.C) jlong,
CallStaticFloatMethod: *const fn (*JNIEnv, jclass, jmethodID, ...) callconv(.C) jfloat,
CallStaticFloatMethodV: *const fn (*JNIEnv, jclass, jmethodID, va_list) callconv(.C) jfloat,
CallStaticFloatMethodA: *const fn (*JNIEnv, jclass, jmethodID, [*c]const jvalue) callconv(.C) jfloat,
CallStaticDoubleMethod: *const fn (*JNIEnv, jclass, jmethodID, ...) callconv(.C) jdouble,
CallStaticDoubleMethodV: *const fn (*JNIEnv, jclass, jmethodID, va_list) callconv(.C) jdouble,
CallStaticDoubleMethodA: *const fn (*JNIEnv, jclass, jmethodID, [*c]const jvalue) callconv(.C) jdouble,
CallStaticVoidMethod: *const fn (*JNIEnv, jclass, jmethodID, ...) callconv(.C) void,
CallStaticVoidMethodV: *const fn (*JNIEnv, jclass, jmethodID, va_list) callconv(.C) void,
CallStaticVoidMethodA: *const fn (*JNIEnv, jclass, jmethodID, [*c]const jvalue) callconv(.C) void,
GetStaticFieldID: *const fn (*JNIEnv, jclass, [*c]const u8, [*c]const u8) callconv(.C) jfieldID,
GetStaticObjectField: *const fn (*JNIEnv, jclass, jfieldID) callconv(.C) jobject,
GetStaticBooleanField: *const fn (*JNIEnv, jclass, jfieldID) callconv(.C) jboolean,
GetStaticByteField: *const fn (*JNIEnv, jclass, jfieldID) callconv(.C) jbyte,
GetStaticCharField: *const fn (*JNIEnv, jclass, jfieldID) callconv(.C) jchar,
GetStaticShortField: *const fn (*JNIEnv, jclass, jfieldID) callconv(.C) jshort,
GetStaticIntField: *const fn (*JNIEnv, jclass, jfieldID) callconv(.C) jint,
GetStaticLongField: *const fn (*JNIEnv, jclass, jfieldID) callconv(.C) jlong,
GetStaticFloatField: *const fn (*JNIEnv, jclass, jfieldID) callconv(.C) jfloat,
GetStaticDoubleField: *const fn (*JNIEnv, jclass, jfieldID) callconv(.C) jdouble,
SetStaticObjectField: *const fn (*JNIEnv, jclass, jfieldID, jobject) callconv(.C) void,
SetStaticBooleanField: *const fn (*JNIEnv, jclass, jfieldID, jboolean) callconv(.C) void,
SetStaticByteField: *const fn (*JNIEnv, jclass, jfieldID, jbyte) callconv(.C) void,
SetStaticCharField: *const fn (*JNIEnv, jclass, jfieldID, jchar) callconv(.C) void,
SetStaticShortField: *const fn (*JNIEnv, jclass, jfieldID, jshort) callconv(.C) void,
SetStaticIntField: *const fn (*JNIEnv, jclass, jfieldID, jint) callconv(.C) void,
SetStaticLongField: *const fn (*JNIEnv, jclass, jfieldID, jlong) callconv(.C) void,
SetStaticFloatField: *const fn (*JNIEnv, jclass, jfieldID, jfloat) callconv(.C) void,
SetStaticDoubleField: *const fn (*JNIEnv, jclass, jfieldID, jdouble) callconv(.C) void,
NewString: *const fn (*JNIEnv, [*c]const jchar, jsize) callconv(.C) jstring,
GetStringLength: *const fn (*JNIEnv, jstring) callconv(.C) jsize,
GetStringChars: *const fn (*JNIEnv, jstring, [*c]jboolean) callconv(.C) [*c]const jchar,
ReleaseStringChars: *const fn (*JNIEnv, jstring, [*c]const jchar) callconv(.C) void,
NewStringUTF: *const fn (*JNIEnv, [*c]const u8) callconv(.C) jstring,
GetStringUTFLength: *const fn (*JNIEnv, jstring) callconv(.C) jsize,
GetStringUTFChars: *const fn (*JNIEnv, jstring, [*c]jboolean) callconv(.C) [*c]const u8,
ReleaseStringUTFChars: *const fn (*JNIEnv, jstring, [*c]const u8) callconv(.C) void,
GetArrayLength: *const fn (*JNIEnv, jarray) callconv(.C) jsize,
NewObjectArray: *const fn (*JNIEnv, jsize, jclass, jobject) callconv(.C) jobjectArray,
GetObjectArrayElement: *const fn (*JNIEnv, jobjectArray, jsize) callconv(.C) jobject,
SetObjectArrayElement: *const fn (*JNIEnv, jobjectArray, jsize, jobject) callconv(.C) void,
NewBooleanArray: *const fn (*JNIEnv, jsize) callconv(.C) jbooleanArray,
NewByteArray: *const fn (*JNIEnv, jsize) callconv(.C) jbyteArray,
NewCharArray: *const fn (*JNIEnv, jsize) callconv(.C) jcharArray,
NewShortArray: *const fn (*JNIEnv, jsize) callconv(.C) jshortArray,
NewIntArray: *const fn (*JNIEnv, jsize) callconv(.C) jintArray,
NewLongArray: *const fn (*JNIEnv, jsize) callconv(.C) jlongArray,
NewFloatArray: *const fn (*JNIEnv, jsize) callconv(.C) jfloatArray,
NewDoubleArray: *const fn (*JNIEnv, jsize) callconv(.C) jdoubleArray,
GetBooleanArrayElements: *const fn (*JNIEnv, jbooleanArray, [*c]jboolean) callconv(.C) [*c]jboolean,
GetByteArrayElements: *const fn (*JNIEnv, jbyteArray, [*c]jboolean) callconv(.C) [*c]jbyte,
GetCharArrayElements: *const fn (*JNIEnv, jcharArray, [*c]jboolean) callconv(.C) [*c]jchar,
GetShortArrayElements: *const fn (*JNIEnv, jshortArray, [*c]jboolean) callconv(.C) [*c]jshort,
GetIntArrayElements: *const fn (*JNIEnv, jintArray, [*c]jboolean) callconv(.C) [*c]jint,
GetLongArrayElements: *const fn (*JNIEnv, jlongArray, [*c]jboolean) callconv(.C) [*c]jlong,
GetFloatArrayElements: *const fn (*JNIEnv, jfloatArray, [*c]jboolean) callconv(.C) [*c]jfloat,
GetDoubleArrayElements: *const fn (*JNIEnv, jdoubleArray, [*c]jboolean) callconv(.C) [*c]jdouble,
ReleaseBooleanArrayElements: *const fn (*JNIEnv, jbooleanArray, [*c]jboolean, jint) callconv(.C) void,
ReleaseByteArrayElements: *const fn (*JNIEnv, jbyteArray, [*c]jbyte, jint) callconv(.C) void,
ReleaseCharArrayElements: *const fn (*JNIEnv, jcharArray, [*c]jchar, jint) callconv(.C) void,
ReleaseShortArrayElements: *const fn (*JNIEnv, jshortArray, [*c]jshort, jint) callconv(.C) void,
ReleaseIntArrayElements: *const fn (*JNIEnv, jintArray, [*c]jint, jint) callconv(.C) void,
ReleaseLongArrayElements: *const fn (*JNIEnv, jlongArray, [*c]jlong, jint) callconv(.C) void,
ReleaseFloatArrayElements: *const fn (*JNIEnv, jfloatArray, [*c]jfloat, jint) callconv(.C) void,
ReleaseDoubleArrayElements: *const fn (*JNIEnv, jdoubleArray, [*c]jdouble, jint) callconv(.C) void,
GetBooleanArrayRegion: *const fn (*JNIEnv, jbooleanArray, jsize, jsize, [*c]jboolean) callconv(.C) void,
GetByteArrayRegion: *const fn (*JNIEnv, jbyteArray, jsize, jsize, [*c]jbyte) callconv(.C) void,
GetCharArrayRegion: *const fn (*JNIEnv, jcharArray, jsize, jsize, [*c]jchar) callconv(.C) void,
GetShortArrayRegion: *const fn (*JNIEnv, jshortArray, jsize, jsize, [*c]jshort) callconv(.C) void,
GetIntArrayRegion: *const fn (*JNIEnv, jintArray, jsize, jsize, [*c]jint) callconv(.C) void,
GetLongArrayRegion: *const fn (*JNIEnv, jlongArray, jsize, jsize, [*c]jlong) callconv(.C) void,
GetFloatArrayRegion: *const fn (*JNIEnv, jfloatArray, jsize, jsize, [*c]jfloat) callconv(.C) void,
GetDoubleArrayRegion: *const fn (*JNIEnv, jdoubleArray, jsize, jsize, [*c]jdouble) callconv(.C) void,
SetBooleanArrayRegion: *const fn (*JNIEnv, jbooleanArray, jsize, jsize, [*c]const jboolean) callconv(.C) void,
SetByteArrayRegion: *const fn (*JNIEnv, jbyteArray, jsize, jsize, [*c]const jbyte) callconv(.C) void,
SetCharArrayRegion: *const fn (*JNIEnv, jcharArray, jsize, jsize, [*c]const jchar) callconv(.C) void,
SetShortArrayRegion: *const fn (*JNIEnv, jshortArray, jsize, jsize, [*c]const jshort) callconv(.C) void,
SetIntArrayRegion: *const fn (*JNIEnv, jintArray, jsize, jsize, [*c]const jint) callconv(.C) void,
SetLongArrayRegion: *const fn (*JNIEnv, jlongArray, jsize, jsize, [*c]const jlong) callconv(.C) void,
SetFloatArrayRegion: *const fn (*JNIEnv, jfloatArray, jsize, jsize, [*c]const jfloat) callconv(.C) void,
SetDoubleArrayRegion: *const fn (*JNIEnv, jdoubleArray, jsize, jsize, [*c]const jdouble) callconv(.C) void,
RegisterNatives: *const fn (*JNIEnv, jclass, [*c]const JNINativeMethod, jint) callconv(.C) jint,
UnregisterNatives: *const fn (*JNIEnv, jclass) callconv(.C) jint,
MonitorEnter: *const fn (*JNIEnv, jobject) callconv(.C) jint,
MonitorExit: *const fn (*JNIEnv, jobject) callconv(.C) jint,
GetJavaVM: *const fn (*JNIEnv, [*c]*JavaVM) callconv(.C) jint,
GetStringRegion: *const fn (*JNIEnv, jstring, jsize, jsize, [*c]jchar) callconv(.C) void,
GetStringUTFRegion: *const fn (*JNIEnv, jstring, jsize, jsize, [*c]u8) callconv(.C) void,
GetPrimitiveArrayCritical: *const fn (*JNIEnv, jarray, [*c]jboolean) callconv(.C) ?*anyopaque,
ReleasePrimitiveArrayCritical: *const fn (*JNIEnv, jarray, ?*anyopaque, jint) callconv(.C) void,
GetStringCritical: *const fn (*JNIEnv, jstring, [*c]jboolean) callconv(.C) [*c]const jchar,
ReleaseStringCritical: *const fn (*JNIEnv, jstring, [*c]const jchar) callconv(.C) void,
NewWeakGlobalRef: *const fn (*JNIEnv, jobject) callconv(.C) jweak,
DeleteWeakGlobalRef: *const fn (*JNIEnv, jweak) callconv(.C) void,
ExceptionCheck: *const fn (*JNIEnv) callconv(.C) jboolean,
NewDirectByteBuffer: *const fn (*JNIEnv, ?*anyopaque, jlong) callconv(.C) jobject,
GetDirectBufferAddress: *const fn (*JNIEnv, jobject) callconv(.C) ?*anyopaque,
GetDirectBufferCapacity: *const fn (*JNIEnv, jobject) callconv(.C) jlong,
GetObjectRefType: *const fn (*JNIEnv, jobject) callconv(.C) jobjectRefType,
GetModule: *const fn (*JNIEnv, jclass) callconv(.C) jobject,
IsVirtualThread: *const fn (*JNIEnv, jobject) callconv(.C) jboolean,
};
pub const JNIEnv = *const JNINativeInterface;
pub const JavaVMOption = extern struct {
optionString: [*c]u8,
extraInfo: ?*anyopaque,
};
pub const JavaVMInitArgs = extern struct {
version: jint,
nOptions: jint,
options: *JavaVMOption,
ignoreUnrecognized: jboolean,
};
pub const JavaVMAttachArgs = extern struct {
version: jint,
name: [*c]u8,
group: jobject,
};
pub const JNI_FALSE: jboolean = 0;
pub const JNI_TRUE: jboolean = 1;
pub const JNI_COMMIT: jint = 1;
pub const JNI_ABORT: jint = 2;
pub const JNI_OK: jint = 0;
pub const JNI_ERR: jint = -1;
pub const JNI_EDETACHED: jint = -2;
pub const JNI_EVERSION: jint = -3;
pub const JNI_ENOMEM: jint = -4;
pub const JNI_EEXIST: jint = -5;
pub const JNI_EINVAL: jint = -6;
pub const JNI_VERSION_1_1: jint = 0x00010001;
pub const JNI_VERSION_1_2: jint = 0x00010002;
pub const JNI_VERSION_1_4: jint = 0x00010004;
pub const JNI_VERSION_1_6: jint = 0x00010006;
pub const JNI_VERSION_1_8: jint = 0x00010008;
pub const JNI_VERSION_9: jint = 0x00090000;
pub const JNI_VERSION_10: jint = 0x000a0000;
pub const JNI_VERSION_19: jint = 0x00130000;
// Use global functions that requires the zig library link to jvm.
pub extern fn JNI_GetDefaultJavaVMInitArgs(args: ?*anyopaque) jint;
pub extern fn JNI_CreateJavaVM(pvm: [*c]*JavaVM, penv: [*c]?*anyopaque, args: ?*anyopaque) jint;
pub extern fn JNI_GetCreatedJavaVMs([*c]*JavaVM, jsize, ?*jsize) jint;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment