# jni

Minimal 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:

```cplus
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) };
}
```

It is deliberately "min": the table is defined through the `Call*Method` family, with enough preceding fields to keep every offset correct. Extend it for later methods (`GetMethodID`, `NewStringUTF`, array ops) by appending fields in `jni.h` order. A layout `#[test]` pins the table sizes (344 / 64 bytes on 64-bit) so a dropped or mistyped field is caught immediately. The package is also the smallest demonstration that `cpc` handles function-pointer struct fields and a type that references itself through a pointer (`JNIEnv = *JNINativeInterface`).
