arsd.jni

jni my.email at gmail.com
Mon Dec 12 11:17:47 UTC 2022


On Monday, 12 December 2022 at 01:28:42 UTC, Adam D Ruppe wrote:
> On Monday, 12 December 2022 at 01:19:23 UTC, jni wrote:
>>     The boilerplate is easy but Then the other part is a 
>> problem for me is the necessary other Java classes. They are 
>> not part of the NDK so the only way to load the jar is to use 
>> jni? Is that correct?
>
> I haven't updated this for a while,but I translated the whole 
> api back in 2020 for my d_android package
>
> https://code.dlang.org/packages/d_android
>
> see for example:
> https://github.com/adamdruppe/d_android/blob/master/java_bindings/android/java/android/net/ConnectivityManager_d_interface.d
>
>
> (but be warned if you import these it can be very slow to 
> compile, so just bringing only the classes you need can be much 
> faster)
>
> I also translated the ndk headers to D back then:
>
> https://github.com/adamdruppe/d_android/tree/master/translated_headers/android/ndk
>
>
> But I never used android beyond hello world so i just don't 
> know THAT much about it.


     Nice. Some of those names do look different but I will give 
it a try. Your arsd.jni library can be used to translate the 
headers then that is helping the cause already. I am not sure if 
the names are different because of seperate APIs having different 
naming for classes? It's good. But you did the java bindings by 
hand or is there a generator in arsd.jni for that too? I am 
interested in using your library anyways if I decide to do some 
of it by hand, if only to verify that what I did was there 
correctly written. This is good but if it can be used on any jar 
then it is even better. Java interfaces are easy and the naming 
scheme for jni is not so bad but I was trying to write as much in 
D as possible forward looking in a situation where I can use it 
again. I haven't taken a look at the client code but I already 
know that it will be substantial so I hope it works and I am 
liking Java more already after this. The d_android Java bindings 
are written in D as I was aiming to do from what I can see it is 
basicly what I planned to do so it is perfect for me.

Thank you for your time.


More information about the Digitalmars-d-learn mailing list