NOTE: this tutorial may no longer work with recent versions of Allegro Common Lisp. This software is supported by Franz, Inc.
Go to the tutorial main page.
RDNZL (pronounced "Redunzl") is a Common Lisp interface to .NET. The software was developed by Dr. Edi Weitz and runs in several different Common Lisp implementations. This tutorial describes how to use RDNZL in Allegro CL.
Microsoft Windows
RDNZL only runs on Microsoft Windows. The examples in this tutorial are tested with Microsoft Windows XP SP2.
Earlier versions of Microsoft Windows may require additional Microsoft files (msvcr71.dll in particular) to run RDNZL. Such files are free, and are included in Microsoft's Visual Studio product for developing .NET applications, but they are currently not included with RDNZL. Please contact Franz Inc. ([email protected]) if you are having trouble running RDNZL on a supported Windows earlier than Windows XP.
.NET Framework
You may already have the .NET Framework installed on your machine. You can check by going to the Start Menu, select Control Panel (may have to use Settings -> Control Panel), select Add or Remove Programs. This should bring up a list of software installed on your machine. If the .NET Framework is included on this list, then it is installed on your machine.
If you need to install the .NET Framework, it is available for free from Microsoft via the Windows Update website (http://update.microsoft.com). You will need to click on the "Custom" button, and then select the "Software, Optional[...]" link to find the .NET Framework entry.
At this writing, two versions of the .NET Framework are available: 1.1, and 2.0. RDNZL works with either of these.
RDNZL
A full description of RDNZL that includes a download link is available at http://weitz.de/rdnzl/
This tutorial includes steps to install RDNZL since RDNZL does not have an executable install script.
Latest CG/IDE patches
If you plan to run this demo from the Debug Window in the IDE, you will need to update your distribution with the latest set of available patches.
Quick Start 1: Install and Load RDNZL
Download and install RDNZL.
At this writing, RDNZL can be downloaded via the following link: http://weitz.de/files/rdnzl.tar.gz
This file is an archive of the RDNZL files stored in "tar" format and compressed in "gzip" format. Various utilities exist to extract the contents from these types of archives. WinZip (http://www.winzip.com) is one such utility.
If you already have the capability to extract the files, please do so now into the Allegro CL installation directory. Typically, this will be the following:
c:\Program Files\aclxx
Thus, the extracted files will be in the directory
c:\Program Files\aclxx\rdnzl-xx
(where 'xx' means version information).
If you do not have the capability to extract the files using a third party utility, then you can do so with Allegro CL as follows.
(require :inflate) (require :tar) ;; Here is where we specify the location of the downloaded file. ;; (defparameter *downloaded-rdnzl-file* "c:/temp/rdnzl.tar.gz") ;; Creates c:\Program Files\aclxx\rdnzl-xx ;; (let ((tar-file (sys:make-temp-file-name "tgze"))) (unwind-protect (progn (with-open-file (in *downloaded-rdnzl-file*) (util.zip:skip-gzip-header in) (with-open-file (out tar-file :direction :output) (util.zip:inflate in out))) (with-open-file (in tar-file) (util.tar:extract-tar in :directory #p"sys:" :verbose t))) (delete-file tar-file)))
At this point, you should have a directory
c:\Program Files\aclxx\rdnzl-xx
(where 'xx' means version information).
Move RDNZL.dll
The extracted RDNZL files should include a file named RDNZL.dll. This file needs to be moved or copied to a place where Lisp can load it automatically. The best place is to have RDNZL.dll be in the Allegro CL installation directory. This can be accomplished within Lisp as follows:
(let ((*default-pathname-defaults* (translate-logical-pathname #p"sys:"))) (sys:copy-file #p"rdnzl-xx/RDNZL.dll" #p"RDNZL.dll"))
where 'xx' is the rdnzl version information.
At this point, RDNZL is installed and ready to use.
Load RDNZL
The following loads RDNZL into Lisp:
(let ((*default-pathname-defaults* (translate-logical-pathname #p"sys:"))) (load #p"rdnzl-xx/load.lisp"))
where 'xx' is the rdnzl version information.
(in-package :rdnzl-user) (enable-rdnzl-syntax) (import-types "System.Windows.Forms" "MessageBox" "MessageBoxButtons" "DialogResult") (use-namespace "System.Windows.Forms") (defun message-box (text &optional (caption "RDNZL")) ;; check if the "OK" button was pressed [Equals [MessageBox.Show text caption ;; we want the message box to have "OK" and ;; "Cancel" buttons [$MessageBoxButtons.OKCancel]] [$DialogResult.OK]]) (message-box "Hello World!") ;; user presses "OK" button [returns] t (message-box "Hello World!") ;; user presses "Cancel" button [returns] nil
This example uses a .NET assembly called AproposGui.dll. This file and its source, AproposGui.cs, are located in the RDNZL examples/ directory.
AproposGui.dll needs to be moved or copied to a place where Lisp can load it automatically. The best place is to have AproposGui.dll be in the Allegro CL installation directory. This can be accomplished within Lisp as follows:
(let ((*default-pathname-defaults* (translate-logical-pathname #p"sys:"))) (sys:copy-file #p"rdnzl-xx/examples/AproposGui.dll" #p"AproposGui.dll"))
where 'xx' is the rdnzl version information.
You can then load examples/apropos.lisp as follows:
(let ((*default-pathname-defaults* (translate-logical-pathname #p"sys:"))) (load #p"rdnzl-xx/examples/apropos.lisp"))
You can run the apropos example as follows:
(in-package :rdnzl-user) (run-apropos-form)
This function returns when the window (apropos dialog) is closed. You can run this function in a separate Lisp process as follows:
(mp:process-run-function "apropos" #'run-apropos-form)
The rdnzl examples folder contains further examples including how to interface to Microsoft Office if you happen to have it installed on your computer.
Return to the tutorial main page.