Adventures with CLISP on Windows 1

Here are some notes taken during a quick session with CLISP.

I wanted to try prototyping a simple application with an RDBMS backend. Clisp doesn’t come with any RDBMS FFIs. So I started looking for one. I was hoping to use ODBC but my hopes were quickly dashed. Not a great deal of specific information to help a newbie get started.

Question 1: Why doesn’t CLISP come with ASDF bundled? I googled around but wasn’t able to get any information

Thankfully, googling for CLISP SQLITE turned up something useful - a Clisp-SQLite FFI. (SQLite is a small embeddable database)

curl -o clisp-sqlite_1.0.tar.gz
    http://ucsub.colorado.edu/~williasr/clisp-sqlite_1.0.tar.gz
curl -o sqlitedll.zip http://www.sqlite.org/sqlitedll-2_8_17.zip
tar zxf clisp-sqlite_1.0.tar.gz
unzip sqlitedll.zip

C:\...> CLISP
[1]> (require  "clisp-sqlite_1.0/clisp-sqlite")
;; Loading file C:\clisp-2.38\clisp-sqlite_1.0\clisp-sqlite.lisp ...
*** - FFI::FOREIGN-LIBRARY: Cannot open library "libsqlite.so"

Whoops, turned out the FFIs are hardwired to libsqlite.so.

C:\CLISP-2.38\> RENAME sqlite.dll libsqlite.so
C:\CLISP-2.38\> CLISP
[1]> (require  "clisp-sqlite_1.0/clisp-sqlite")
;; Loading file C:\clisp-2.38\clisp-sqlite_1.0\clisp-sqlite.lisp ...
;;  Loaded file C:\clisp-2.38\clisp-sqlite_1.0\clisp-sqlite.lisp

Question 2: What is necessary to make Clisp on Windows user experience so that "It-Just-Works"?

Things seem to work pretty well afterwards:

(require "clisp-sqlite_1.0/clisp-sqlite")
(sqlite:with-open-db (db "test.db")
    (sqlite:sql db
        "create table todo (todoid int, name varchar(50), done int)")
    (sqlite:sql db
        "insert into TODO (TODOID, Name, Done) VALUES (1, 'USE LISP', 0)")
    (format t "~a" (sqlite:sql db
        "SELECT TODOID, Name, Done FROM TODO")))

Question 3: Are there any standard APIs that the Lisp community uses to access databases? CLSQL seems promising.. but CLISP wasn’t mentioned in the compatibility list. What about MaiSQL ? Where’s the consensus here?

Answers appreciated.

One Response to “Adventures with CLISP on Windows 1”

  1. Mike writes:

    Clisp comes with BSDDB support built in. There seems to be some tension between the ASDF/SBCL people and the CLISP people (Not sure why), which may be why CLISP doesn’t support ASDF. It is entirely possible to install ASDF in CLISP. I also found the hardwiring of the library name to be odd in CLISP-Sqlite, simple enough to fix though.

Leave a Reply