Skip to content
Example Project Using Chicken Scheme on Android
Scheme Java
Find file
Pull request Compare This branch is 2 commits behind bevuta:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
androidChickenTest
scm
.gitignore
Makefile
README.org
backend.org
make-settings.scm

README.org

Example project for Chicken Scheme on Android

This project shows how the Chicken Scheme runtime can be used in Java/Android.

Prerequisites

  • First of all you need a Chicken Scheme corss compiler toolchain to build this project
  • Replace the values for CHICKEN_PATH, SDK_PATH, NDK_PATH in the Makefile with the values matching your system configuration. Of course the CHICKEN_PATH needs to be set to the directory where your cross compiler toolchain was build in.

To use this example you need to install three extra eggs into your cross compiler toolchain.

  • jni - https://github.com/chicken-mobile/jni - JNI is the interface used to share data betweewn Java and Chicken. it gives us the ability to access memory methods in the JVM.
  • android-log - https://github.com/chicken-mobile/android-ndk/tree/master/android-log - Normally an Activity got no stdin and stdout instead Android uses its own logging facility. By loading this egg current-input-port and current-output-port are redirected into a line buffered port that prints lines with either error or info priority to the Android log so that we ware able to use print etc. naturally. Writing to stdout or stderr kills the application immediately.

Build

  • If you build the cross compiler, setup the Makefile and installed the eggs you can continue to build the application package by using make. This will compile all scheme code in the “scm/” directory to shared objects for android, copy them along with all eggs installed into our cross compiler toolchain into the Android project, build the project and tries to install it on an attached phone.

How to Use

  • The Makefile will compile every “.scm” in “scm/” for use in Android.
  • The path “scm/include” is in the include path and can be used to include “.scm” files you dont wont to compile separately as shared object for Android.
  • Installed eggs will be copied over if they changed in the cross compiler toolchain.
  • This is just a basic example on how to package the Chicken runtime into an Android application. You can get a better idea how things will work when you read the Backend.org file in this repository. Basically calls into Chicken from Java are signaled through a pipe and some mechanism waits for them to be processed.
Something went wrong with that request. Please try again.