Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can GNAT Community projects be compiled to the Android platform?

65 views
Skip to first unread message

梅煜

unread,
Sep 8, 2022, 6:28:15 PM9/8/22
to
Can GNAT Community projects be compiled to the Android platform? or NDK?
If so, how should it be done?

Luke A. Guest

unread,
Sep 9, 2022, 2:55:12 AM9/9/22
to
On 08/09/2022 23:28, 梅煜 wrote:
> Can GNAT Community projects be compiled to the Android platform? or NDK?
> If so, how should it be done?

Since google moved to clang, you'd need to check to see if they do what
apple does which prohibits gpl components being used.

It's not been done for a while afaik, I've not compiled the compiler for
a long time and I'm rusty on the details. You basically need an arm
(--target=<your target triple> you should get this from the equivalent
c/c++ compiler in the ndk for the version you are targetting) cross
compiler.

You then need either a Java startup activity which calls into Ada code
or an Ada NativeActivity which binds the C version in the ndk, that will
call AdaInit and AdaFinal (think that's the right name).

If you need to call into any lib on Android which requires a binding,
you need to generate that, so either a C binding or a JNI binding. I
have a JNI package on my github which you can use as a start, a tool to
get generate the bindings to Java would be required as JNI is really
tedious.

https://github.com/Lucretia/jni
https://github.com/Lucretia/jni/blob/master/tests/test.adb


0 new messages