Hello, world from CLisp on Windows
Now here are steps to build a Windows application as for “hello, world”
Create a message.lisp:
(use-package "FFI")
(def-call-out messagebox
(:name "MessageBoxA") (:library "user32.dll")
(:arguments (hwnd int) (text c-string) (capt c-string) (type uint))
(:return-type int)
(:language :stdc))
(defun main()
(messagebox 0 "Hello World!" "Message" 0)
(quit))
then run:
clisp -M “C:\Program Files\clisp-2.47\base\lispinit.mem” -x “(load \”message.lisp\”)(ext:saveinitmem \”message\” :init-function #’main :executable t :norc t :quiet t)”
now we have a message.exe under the same directory, run it, you will get a standard Windows message box like this:
Almost all stuffs mentioned here are coming from:
except I added “:quiet t” to avoid CLisp’s welcome messages printed out in screen.