Functions in the Win32 API that handle strings come in two flavors, one for ANSI strings and one for Unicode strings. Windows ME only supports the ANSI functions but Windows XP/Vista/7 support both. The functions are named with a single letter suffix, an
for the ANSI functions and a
for the Unicode functions. So for example both
exist. In C, this is finessed by the use of #define in the header files.
There are two ways to handle this:
functions. This will allow your code to work on all supported versions of Windows, but will prevent the use of Unicode on Windows XP/Vista/7 (this is typically only a problem if you are handling mixed language data), or
in define-foreign-function. This will cause it to switch between ANSI and Unicode versions depending on the operating system.
In either case, as well as calling the correct function, you must encode/decode any string arguments/results correctly, to match the
in the function name. The foreign types
correspond to the typical ones found in the Win32 API. For more information about these foreign types, see their manual pages in the
LispWorks User Guide and Reference Manual
LispWorks Foreign Language Interface User Guide and Reference Manual - 7 Dec 2011