MOCL for Android Part 2: Drakma

In this post we will enable Drakma HTTP support in the Android/MOCL example code. I have forked the repo on Github for posterity. The first post is here and it will get you set up with the Android/MOCL example without Drakma.

First we must download dependencies.

Drakma USocket Flexi-Streams Chunga CL-BASE64 Puri

My libs are located in mocl/systems. So I that’s where I place the folders of code, then link the .asd files. The instructions may change slightly with different versions of libs.

cd mocl/systems
ln -s drakma-1.3.7/drakma.asd drakma.asd
ln -s usocket-0.6.1/usocket.asd usocket.asd
git clone
ln -s cl-ppcre/cl-ppcre.asd cl-ppcre.asd

Note that cl-ppcre-unicode.asd also exists. Also of note is the version of trivial-gray-streams in use here. As of this writing the current version is causing issues and the version presented below should be used.

ln -s flexi-streams-1.0.12/flexi-streams.asd flexi-streams.asd
git clone
ln -s wukix-trivial-gray-streams/trivial-gray-streams.asd trivial-gray-streams.asd
ln -s chunga-1.1.5/chunga.asd chunga.asd
ln -s cl-base64-3.3.3/cl-base64.asd cl-base64.asd
ln -s puri-1.5.5/puri.asd puri.asd

So after doing the linking dance we can uncomment the Drakma code in app.lisp (5 lines):

(pushnew :drakma-no-ssl *features*)
(require :drakma)
(declaim (call-in net-test))
(defun net-test ()
(print (drakma:http-request "")))

but we have to change out because as of this writing wukix has changed their site to redirect to https, and drakma can’t use ssl yet. In my case I changed it to because it currently accepts over http.

and add net_test to our In this case we just log out the result

try {
String dataDir = getDataDir();
} catch (Exception e) {
// TODO Auto-generated catch block

and run:

cd mocl-example-lisp-contacts-android
mocl --android LispContacts app.lisp
cd LispContacts/jni

Then simply debug the project in ADK and watch the logcat output. The result should show up as an error, since we used Log.e("",""), with a tag of CL.