Недавно я начал изучать Common Lisp с помощью SBCL. Как я могу скомпилировать мои программы Lisp в двоичный файл Windows?
Компиляция Common Lisp в исполняемый файл
Ответ 1
Создание 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 исполняемый файл!
Ответ 2
Используйте SB-EXT:SAVE-LISP-AND-DIE
. Подробнее см. http://www.sbcl.org/manual/#Saving-a-Core-Image.
Ответ 3
Для этого есть несколько инструментов. Вы можете начать с Buildapp.
Ответ 4
(defun main() (формат t "Привет, мир! ~%" ))
(sb-ext:save-lisp-and-die "hello-world.exe"
:executable t
:toplevel 'main)