From: co (Charles A. Cox)

Subject: Re: [pcspr3533] interface Serial Ports?

Date: 1996-5-20 19:36

> Has anyone written a Lisp interface to serial ports for ACL/Win? > > I haven't given much thought to what the interface should look like. I would > like to use whatever is out there. I'm just getting started with Allegro CL > for Windows version 3.0. I took a look in osidoc.txt and I noticed that the > CreateFile() Win32 API function does not seem to be in there. Is this just > because Franz didn't get around to adding all of the FFIs for the Win32 API?
Thanks for your question. While a large chunk of the Win32 API is available as lisp functions and constants named by symbols in the windows package, not all of the the Win32 API were pre-built into the lisp. One can still use ffi, though, to access the remaining API routines by using ct:defun-dll. You have to be aware, though, that for certain API such as CreateFile() which take string arguments, there is an "Ansi" and a "Wide" version of these functions. These are named in the dlls as CreateFileA() and CreateFileW(). So, to define and use the Ansi CreateFile() in aclwin, you'd have to do something like the following: (ct:defun-dll createfile (..arguments..) :entry-name "CreateFileA" :return-type ... :library-name "shell32.dll") As for the serial ports, one can open a COM port using (open "com2" :direction :output) and then use the usual lisp functions for writing to a stream. Charley --- Charles A. Cox, Franz Inc. 1995 University Avenue, Suite 275 Internet: <franz.com at cox> Berkeley, CA 94704 WWW: http://www.franz.com/ Phone: (510) 548-3600; FAX: (510) 548-8253