All Manuals > LispWorks Foreign Language Interface User Guide and Reference Manual > 6 Type Reference

NextPrevUpTopContentsIndex

:ef-mb-string

FLI type descriptor
Summary

Converts between a Lisp string and a C multi-byte string .

Syntax

:ef-mb-string &key limit external-format null-terminated-p

Arguments

limit

The maximum number of bytes of the C multi-byte string.

external-format

An external format specification.

null-terminated-p
A boolean controlling the null termination byte.

Description

The FLI :ef-mb-string type converts between a Lisp string and a C multi-byte string. The C string may have a maximum length of limit bytes. The limit can be omitted in cases where a new foreign string is being allocated.

The external-format is used to specify the encoding of the foreign string. It defaults to an encoding appropriate for C string of type char* . If you want to pass a string to the Windows API, known as STR in the Windows API terminology, specify win32:*multibyte-code-page-ef* , which is a variable holding the external format corresponding to the current Windows multi-byte code page. To change the default, call set-locale or set-locale-encodings.

If null-terminated-p is non-nil, a NULL byte is added to the end of the string.

Notes

If you want to pass a string argument by reference but also allow conversion from Lisp nil to a null pointer, specify the :reference type :allow-null argument, for example:

(:reference-pass :ef-mb-string :allow-null t)
See also

:ef-wc-string
:reference
set-locale
set-locale-encodings
Strings


LispWorks Foreign Language Interface User Guide and Reference Manual - 7 Dec 2011

NextPrevUpTopContentsIndex