39

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

4

4 回答 4

36

制作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 可执行文件!

于 2013-10-29T08:30:22.653 回答
14

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

于 2013-01-05T12:44:12.010 回答
10

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

于 2013-01-06T14:18:26.220 回答
7
(defun main ()
    (format t "Hello, world!~%"))

(sb-ext:save-lisp-and-die "hello-world.exe"
:executable t
:toplevel 'main)
于 2015-09-29T13:55:08.760 回答