arsd.jni

jni my.email at gmail.com
Wed Dec 14 05:29:43 UTC 2022


On Monday, 12 December 2022 at 15:03:13 UTC, Adam D Ruppe wrote:
> On Monday, 12 December 2022 at 11:17:47 UTC, jni wrote:
>> It's good. But you did the java bindings by hand or is there a 
>> generator in arsd.jni for that too?
>
> It does it automatically. You compile jni.d with 
> `-version=WithClassLoadSupport` and then write a main function 
> that calls `jarToD("path/to/file.jar", "whatever.d.name", 
> "output_directory", JavaTranslatorConfig(true, true, true));`
>
> Or something like that. It has been 3 years lol. But I put some 
> docs in there too
>
> http://arsd-official.dpldocs.info/arsd.jni.jarToD.html
>
> http://arsd-official.dpldocs.info/arsd.jni.JavaTranslationConfig.html
>
>
> For the C .h files, I used the `dstep` program
> https://github.com/jacob-carlborg/dstep/
>
> with a bit of hand edits after.


     I had jni.d already, not so sure if it was from an earlier 
module that I have worked on but I am pretty sure that file was 
already it was there. I don't know what I could've used it for. 
With Dstep I heard of it before maybe 6 years ago and all this 
years I thought it was for Objective C, that is why I had to do 
those myself using extern, but it was only a few functions. But 
this java translator it interests me greatly how with such a 
small library it can do that. Does it import a VM that is 
different from the JVM for the translation or did you sit down 
and write the Java implementation for it yourself? Because it 
seemed like a small library when I last took a look. Very nice. 
Android is the only phone besides buying a $1,000 iphone and for 
me it doesn't really make much sense. Android is much more better 
for programming and I myself don't mind its quirks. It's not a 
perfect phone but the Kotlin and Java options are just not what I 
need in my line of work. Probably some day I will have no choice 
but to learn Java again! That is what I expect will happen in the 
future and it is laughable, but for now it is a much better thing 
to have the D language available to me for writing this simple 
scripts that I have to do on occasion. If I write something 
worthwhile I will be sure to put it on code.dlang.org and name it 
Triple-D.


More information about the Digitalmars-d-learn mailing list