Ehem, ARM

Chris wendlec at tcd.ie
Wed Nov 27 05:52:15 PST 2013


On Tuesday, 26 November 2013 at 11:22:59 UTC, Joakim wrote:
>
> What JNI-D stuff have you tried and on what platform, 
> linux/x86?  I'll try the shared library approach on Android at 
> some point and report back.

If I remember correctly, I did something like this (think it was 
on OS X):

1. Create D library (seems to be necessary?)
dmd -lib hello.d -oflibhelloD

2. Compile (do not link)
gcc -c hello.c -o helloC.o // Calls D code

3. JNI (compile)
gcc -c -I/path/to/Java/Headers Test.c -o Test.o // JNI file 
(calls hello.c)

4. Create library.
gcc -dynamiclib -o libTest.jnilib -lphobos2 -lhelloD Test.o 
helloC.o

And it worked. I don't know, if step 2. is necessary at all.

I've also been able to successfully combine Python and D, so that 
the D module could be loaded and used by Python like any other 
module. I could also link D and Objective-C. But that was all on 
Desktop (Mac OS X and Linux). I haven't tried it for Android or 
iOS yet.



More information about the Digitalmars-d mailing list