将Common Lisp编译为可执行文件

时间:2013-01-05 12:35:53

标签: build common-lisp sbcl

我最近开始使用SBCL学习Common Lisp。如何将我的Lisp程序编译成Windows二进制文件?

4 个答案:

答案 0 :(得分:25)

制作hello.exe:

* (defun main () (print "hello"))

MAIN
* (sb-ext:save-lisp-and-die "hello.exe" :toplevel #'main :executable t)
[undoing binding stack and other enclosing state... done]
[saving current Lisp image into hello.exe:
writing 3160 bytes from the read-only space at 0x22000000
writing 2592 bytes from the static space at 0x22100000
writing 30134272 bytes from the dynamic space at 0x22300000
done]
> dir hello.exe
31,457,304 hello.exe
> hello.exe

"hello"

31 MB可执行文件!

答案 1 :(得分:12)

使用SB-EXT:SAVE-LISP-AND-DIE。有关详细信息,请参阅http://www.sbcl.org/manual/#Saving-a-Core-Image

答案 2 :(得分:8)

有几种工具可以做到。您可以从Buildapp开始。

答案 3 :(得分:4)

(defun main ()
    (format t "Hello, world!~%"))

(sb-ext:save-lisp-and-die "hello-world.exe"
:executable t
:toplevel 'main)