Yellow Rabbit

Frozen

Here is an active version

Lisp: Executable File Instead of Source

Lisp: Creating a Standalone  Executable File

The desire to make a separate stanalone executable file, although you can just give the source code, is a little strange, but let’s say that such a need arose.

The project by this time has already acquired a finished look and is organized as a local quicklisp system. Here you can read how to create a convenient development environment immediately.

Next, you need buildapp, it’s an executable, so we go to the directory that we have in ${PATH}. For me it is ~/local/bin. Run sbcl


(ql:quickload 'buildapp)
(buildapp:build-buildapp)

We move to the project directory and run sbcl, load our project (in my case test-cffi) and write its manifest.


(ql:quickload :test-cffi)
(ql:write-asdf-manifest-file "test-cffi.manifest")

And finally:


% buildapp --output test-cffi --manifest-file test-cffi.manifest \
--load-system test-cffi --entry test-cffi:main
% ls -l
-rw-r--r--  1 rabbit  rabbit      1654 01-May-2016 20:49 test-cffi.manifest
-rw-r--r--  1 rabbit  rabbit       111 01-May-2016 20:57 package.lisp
-rw-r--r--  1 rabbit  rabbit        57 17-Apr-2016 15:22 README.txt
-rwxr-xr-x  1 rabbit  rabbit  57802800 01-May-2016 22:06 test-cffi*
-rw-r--r--  1 rabbit  rabbit       280 17-Apr-2016 15:45 test-cffi.asd
-rw-r--r--  1 rabbit  rabbit      2181 01-May-2016 20:59 test-cffi.lisp

The function main, which should be exported from our project looks like this:


(defun main (argv)
  (declare (ignore argv))
  (win-box))