Ehem, ARM

Joakim joakim at airpost.net
Tue Nov 26 03:22:58 PST 2013


On Tuesday, 26 November 2013 at 09:53:07 UTC, Chris wrote:
> On Monday, 25 November 2013 at 22:32:26 UTC, Joakim wrote:
>> Next, getting this minimal app running on Android/x86.  It 
>> turns out there is some support for building executables 
>> directly in the Android NDK, just undocumented, though the 
>> docs are fairly bad generally.
Whoo, I just got the above "hello world" app to run on 
Android/x86 4.3! :D I just compiled the object file with dmd 
patched to take out _d_dso_registry and using the invocation 
above, then linked it with the gold linker, Android libraries, 
and flags that the Android NDK uses, and ran it from a terminal 
in an Android/x86 VM.  I was not looking forward to debugging 
arcane ABI issues and it looks like I may not have to. :) I think 
I'll just use this pure native route to port druntime for now.

> Interesting. Johannes mentioned that the main app should always 
> be in Java so it goes through Dalvik. I've done some JNI-D 
> stuff already (only a proof-of-concept command line app 
> though). I wonder what's the best way of porting D to mobile 
> OS's (mainly Android and iOS).
That is what the docs say if you want to build a native Android 
app, presumably that you distribute through the Play Store.  But 
you can always build a native app for your own local dev build of 
Android, at least for porting purposes.

But look at the test-libstdc++ sample app in the NDK: they 
actually build it as an executable, not a shared library.  I 
haven't tested yet if that's a mistake or if it will actually 
work.  In other words, I don't know if they enforce the shared 
library approach, whether technically or through some Play Store 
certification process, but it certainly is the officially blessed 
approach.

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.


More information about the Digitalmars-d mailing list