[pro] lisp on mobile platforms these days

Daniel Herring dherring at tentpost.com
Sun Apr 27 16:39:34 UTC 2014


On Sun, 27 Apr 2014, Attila Lendvai wrote:

> what are the downsides of connecting to the NDK (android C API)? how
> much of android is not available through the NDK?

When I tried using Lisp on Android a couple years ago, the going was rough 
to say the least.  Today, there are a handful of Scheme implementations, 
Maxima, and other Lisps on the Play Store that seem to work pretty well. 
Unfortunately, time is short lately.

I did get a bit of experience with Android and the NDK.  NDK applications 
are quite feasible, but they are discouraged by Google and so the 
documentation and tooling is less refined.

Basically, "Android" is a heavily modified Linux distribution with a 
Java-based desktop interface.  So C/C++ and other NDK programs and 
libraries will run much as they do on any other Linux distribution.

Android uses a custom Java VM (Dalvik) to enable application portability 
across different architectures.  NDK programs must be compiled separately 
for each supported architecture, possibly with multiple architectures in 
an APK (application package).

https://developer.android.com/tools/sdk/ndk/index.html#Contents


So if you have your own GUI library (say using OpenGL ES), you can write 
the whole application as a "Native Activity".

https://developer.android.com/reference/android/app/NativeActivity.html

Or run your apps on the command line using a program like Terminal IDE.


For everything else, you can use JNI bindings.  The coding style is 
similar to using FFI bindings to talk to C libraries.  On desktop systems, 
there are often conflicts between the GC mechanisms used by CL and Java, 
so this would be something to watch out for on Android as well.

The JFLI and CL+J projects were attempts at CL bindings to the JNI.  I 
haven't looked whether the JNI offered by Dalvik would require any 
modifications to these projects.


CCL has an implementation of JFLI and ARMv7 support, so it might be a 
viable solution on some tablets.

http://trac.clozure.com/ccl/browser/trunk/source/examples/jfli
http://trac.clozure.com/ccl/wiki/ReleaseNotes/1.9


- Daniel




More information about the pro mailing list