[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Chicken Scheme for mobile devices?
From: |
Stephen Eilert |
Subject: |
Re: [Chicken-users] Chicken Scheme for mobile devices? |
Date: |
Wed, 14 Nov 2012 11:37:37 -0300 |
Yes, please. I've been toying with this idea for quite a while now.
Chicken already works without modification on iOS. However, since you cannot link to third party libraries dynamically, you'd have to compile two versions (x86 one for the simulator, ARM version for the device) and statically link to the correct version.
What I have done previously (successfully), was to grab the generated C Chicken (runtime.c, srfi-1.c, ports.c, etc) and added to the XCode project. Then, I compiled my program and asked csc to just dump the .c files. I then added it to the project as well. Also added a Makefile so that they would get recompiled as necessary.
That worked, I was even able to open a remote REPL and make changes and have them displayed in the device (the OpenGLES drawing code was written in Scheme). The advantage of this approach was that one doesn't need to care what the target device is. However, it is too 'hackish' for my tastes. Not to mention that it would be a pain to add eggs. But it proved that Chicken works fine on iOS.
Since one can call Scheme functions from C, it is trivial to do so using Objective-C. The other way around should be possible too, but I haven't poked too much into Objective-C's internals yet. If all else fails, we could always write 'foreign code'.
Building a cross compiler (and using the correct one in the iOS build system) is rather tedious, as is statically linking the correct eggs. If we had a tool to generate a 'template' project and maintain it, we'd have a winner. Actually building it could be accomplished by xcodebuild, as long as we add a build step that calls csc.
I'm talking about iOS since that's what I am used to, but this could be even better under, say, Android. Anyone knows what the state of the NDK nowadays? Would we be able to create apps in mostly Scheme?