This page was edited more than a year ago (2010-03-11), content might not be relevant or accurate anymore.

Standalone Common Lisp executables

Let's say we have code like this:

(defpackage :app
  (:use :cl)
  (:export :main))
(in-package :app)
(defun main ()


This is supposed to work like this:

cl-launch --lisp sbcl --system app --dump app-image
cl-launch --image app-image --init '(app:main)' -o app

using the same system definition listed below.

You can use various CL implementations.


In SBCL it's something like:

(require 'asdf)
(asdf:operate 'asdf:load-op :app)
(sb-ext:save-lisp-and-die "program" :executable t :toplevel 'app:main)

with usage of app.asd:

(defsystem :app
  :name "app"
  :components ((:file "app")))

The output is rather big in the time of writing, gzexe may compress it but startup will take a little longer.


In ECL it's done along the lines of:

(compile-file "program.lisp" :system-p t)
(c:build-program "program" :lisp-files '("program.o")
                           :epilogue-code '(ext:quit (app:main)))

Epilogue code starts the main and quits with return code instead of starting REPL. Program is really small but it depends on libecl shared library.

Back to top
howto/standalone_common_lisp_executables.txt · Last modified: 2010/03/11 19:43 by disorder
disorder's homepage Valid CSS Valid XHTML 1.0 Recent changes RSS feed