Skip to content
Generate nicer glue for Java Native Interface (JNI)
Python
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
JNIGlue
README

README

The enclosed Python script reads jni.h (for example, as included with
the Android NDK) and generates nicer wrapper glue for calling JNI
routines from C. For example, the FindClass routine normally has to be
called something like this:

    the_class = (**env).FindClass(env, class_name);

but JNIGlue generates a wrapper that looks like this:

    static inline jclass JNFindClass(JNIEnv* env, const char* a1)
      {
        return
            (**env).FindClass(env, a1);
      } /*FindClass*/

allowing for slightly more convenient invocation like this:

    the_class = JNFindClass(env, class_name);

All the wrapper routines are generated with names consisting of the
original JNI routine name prefixed with “JN”. If you don’t like it,
change it.

Lawrence D'Oliveiro <ldo@geek-central.gen.nz>
Something went wrong with that request. Please try again.