Converts between a Lisp string and a C multi-byte string.
keyword
:ef-mb-string &key limit external-format null-terminated-p
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. |
The FLI type :ef-mb-string
converts between a Lisp string and a C multi-byte string. The C string may have a maximum length of limit bytes. limit can be omitted in cases where a new foreign string is being allocated.
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.
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)
:ef-wc-string
:reference
set-locale
set-locale-encodings
2.2.2 Strings
Foreign Language Interface User Guide and Reference Manual - 01 Dec 2021 19:34:59