Usually, to save a lisp image, we must call SBCL from the terminal and call save-lisp-and-die from there. If we attempt to do it from the Slime REPL, we get an error related to too many threads: we can't do it while the REPL thread is running.
Here is a snippet given by Akasha on Discord for Sly.
(defun sbcl-save-sly-and-die ()
"Save a sbcl image, even when running from inside Sly.
This function should only be used in the *inferior-buffer* buffer,
inside emacs."
(mapcar #'(lambda (x)
(slynk::close-connection
x nil nil))
slynk::*connections*)
(dolist (thread (remove
(slynk-backend::current-thread)
(slynk-backend::all-threads)))
(slynk-backend::kill-thread thread))
(sleep 1)
(sb-ext:save-lisp-and-die #P"~/your-main-program.exe"
:toplevel #'your-main-function-here
:executable t
:compression t))
;; in *sly-inferior-lisp* buffer
(sbcl-save-sly-and-die)
(untested by me)
Usually, to save a lisp image, we must call SBCL from the terminal and call save-lisp-and-die from there. If we attempt to do it from the Slime REPL, we get an error related to too many threads: we can't do it while the REPL thread is running.
Here is a snippet given by Akasha on Discord for Sly.
(untested by me)