[Info-vax] Groovy on VMS

Arne Vajhøj arne at vajhoej.dk
Mon Mar 4 19:17:03 EST 2024


On 3/4/2024 4:25 PM, Lawrence D'Oliveiro wrote:
> On Mon, 4 Mar 2024 15:49:27 -0500, Arne Vajhøj wrote:
>> JNI is tricky (read: it sucks).
> 
> I managed to do some stuff in Android with it, back in the day. I
> created a Python script
> <https://bitbucket.org/ldo17/jniglue/src/master/> that generates
> slightly more convenient wrappers around the entry points in the
> JNIEnv object, e.g. for the NewStringUTF method:
> 
>      static inline jstring JNNewStringUTF(JNIEnv* env, const char* a1)
>        {
>          return
>              (**env).NewStringUTF(env, a1);
>        } /*NewStringUTF*/
> 
> so you call it like this:
> 
>      const jstring msgobj = JNNewStringUTF(env, usebuf);
> 
> I felt it made things much more bearable.

That converts the C++ API to a C API, but there is more
hassle in JNI than that.

Arne

PS: (**env).Foobar is rather unusual - the common style is
     (*env)->Foobar.



More information about the Info-vax mailing list