(defun main ()
(format t "hello, world!~%"))
(sb-ext:save-lisp-and-die "hello-world"
:executable t
:toplevel 'main)
下面記錄一下ccl編譯一個可執行程式的過程,其中最關鍵的是ccl:save-application<code></code>
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 [email protected] 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