Compiling Common Lisp to an executable

♀尐吖头ヾ 提交于 2019-12-03 01:41:31

问题


I recently started learning Common Lisp using SBCL. How can I compile my Lisp programs into a Windows binary?


回答1:


Making 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 executable file!




回答2:


Use SB-EXT:SAVE-LISP-AND-DIE. See http://www.sbcl.org/manual/#Saving-a-Core-Image for details.




回答3:


There're several tools to do it. You can start with Buildapp.




回答4:


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

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


来源:https://stackoverflow.com/questions/14171849/compiling-common-lisp-to-an-executable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!