Developing and running D GUI app on Android

Adam D. Ruppe destructionator at gmail.com
Wed Jan 13 20:46:05 UTC 2021


On Wednesday, 13 January 2021 at 20:23:22 UTC, H. S. Teoh wrote:
>    Adam may be written a script for this, I'm not 100% sure.

Yeah, my code does it all, though the auto-generation is more 
about accessing Java from D than vice versa, since implementing 
the D parts are simple.

See the example at the top here:
http://dpldocs.info/experimental-docs/arsd.jni.html

Just write the @Export things in D with the right signature for 
the native things in Java and it will just work.

There's code in jni.d to auto-generate stubs but there's really 
no need since it is so simple; you rarely have all *that* many 
native things anyway.

>    Adam's jni.d, this is generally very painless: you just 
> declare the
>    Java class using an equivalent D class, and jni.d uses 
> introspection
>    to auto-generate the JNI boilerplate for you, then you can 
> just call
>    it as if it were a D object.

yeah, and it can even read a .jar file to generate the D bindings 
with necessary @Imports automatically (just remember it compiles 
slow to bring it all in so i wouldn't do it when you just need a 
few things.)


More information about the Digitalmars-d-learn mailing list