sbcl
(defun main ()
(format t "Hello, world!~%"))
(sb-ext:save-lisp-and-die "hello-world"
:executable t
:toplevel 'main)
ccl
下面记录一下ccl编译一个可执行程序的过程,其中最关键的是ccl:save-application
apple@apple-System:~$ ccl
Welcome to Clozure Common Lisp Version 1.11-r16635 (LinuxX8632)!CCL is developed and maintained by Clozure Associates. For more information
about CCL visit http://ccl.clozure.com. To enquire about Clozure's Common Lisp
consulting services e-mail info@clozure.com or visit http://www.clozure.com.
? (defun hello-world ()
(format t "Hello, world"))
HELLO-WORLD
? (defun main ()
(hello-world))
MAIN
? (ccl:save-application "test"
:toplevel-function #'main
:prepend-kernel t
:purify t
:impurify t)
apple@apple-System:~$ ./test
Hello, world
apple@apple-System:~$ file test
test: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=4daa568917548153e303eb1bf285371cd635f875, not stripped
apple@apple-System:~$ ll test
-rwxr-xr-x 1 apple apple 18919440 1月 4 22:30 test*
参考
http://www.cliki.net/Creating%20Executables