Jul 072009
 

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)”helloworld

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:

http://www.frank-buss.de/lisp/clisp.html

except I added “:quiet t” to avoid CLisp’s welcome messages printed out in screen.

Jul 072009
 

Since I don’t have much to do this week and I cannot go anywhere, I decided to learn some Lisp stuffs as it does not need too much online resource, well, sort of.