LispWorks User Guide and Reference Manual > 13 LispWorks as a dynamic library > 13.2 Creating a dynamic library

NextPrevUpTopContentsIndex

13.2.3 Example

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

-------------------- hello.lisp -------------------------
(in-package "CL-USER")
(load-all-patches)
;; 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-6-0-0-x86-win32.exe -build hello.lisp

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

(See Saving a LispWorks image 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 and Reference Manual - 22 Dec 2009

NextPrevUpTopContentsIndex