jni
Java Native Interface bindings. The package provides #[repr(C)] mirrors of the JVM's jni.h dispatch tables — JNINativeInterface (the JNIEnv function table) and JNIInvokeInterface (the JavaVM table) — plus the jint / jlong / jobject type aliases.
The JVM hands you a pointer to one of these tables; you read a function pointer out of it and call it through env, exactly as C's (*env)->FindClass(env, ...) does:
import "jni/jni" as jni;
fn get_version(env: jni::JNIEnv) -> jni::jint {
let f: fn(jni::JNIEnv) -> jni::jint = unsafe { (*env).GetVersion };
return unsafe { f(env) };
}
The table is complete: all 233 slots of the JNI 1.6 function table, verified field-for-field against the NDK's jni.h, so object arrays, RegisterNatives, ExceptionCheck, NewDirectByteBuffer, and the rest are all callable. A layout #[test] pins the table sizes so a dropped or mistyped field is caught immediately.
One subtlety the package gets right: JNIEnv is modeled as the double pointer JNI actually requires (JNIEnv = *JNINativeInterface, and native methods receive *JNIEnv) — passing the bare table pointer instead trips an ART abort at runtime. This is also the smallest demonstration that cpc handles function-pointer struct fields and a self-referential pointer type. It is the foundation android_view builds on.