14.2.3 Example

This script saves an image hello.dll which is a Windows DLL:

-------------------- hello.lisp -------------------------
(in-package "CL-USER")
;; The signature of this function is suitable for use with
;; rundll32.exe.
(fli:define-foreign-callable ("Hello"
                              :calling-convention :stdcall)
    ((hwnd w:hwnd)
     (hinst w:hinstance)
     (string :pointer)
     (cmd-show :int))
  (capi:display-message "Hello world"))
(save-image "hello"
            :dll-exports '("Hello")
            :environment nil)

Run the script by

lispworks-5-1-0-x86-win32.exe -build hello.lisp

on the command line, or use the Application Builder tool.

(See Customization of LispWorks for more information about how to save an image.)

You can test the DLL by running

rundll32 hello.dll,Hello

on the command line.

To see the dialog, you may need to dismiss the LispWorks splashscreen first.

LispWorks User Guide - 11 Mar 2008