All Manuals > LispWorks Foreign Language Interface User Guide and Reference Manual > 7 Function and Macro Reference

NextPrevUpTopContentsIndex

convert-to-dynamic-foreign-string

Function
Summary

Converts a Lisp string to a foreign string within the scope of the body of a with-dynamic-foreign-objects macro.

Package

fli

Signature

convert-to-dynamic-foreign-string string &key external-format null-terminated-p allow-null => pointer, length, byte-count

Arguments

string

A Lisp string.

external-format

An external format specification.

null-terminated-p

If t, the foreign string terminates with a null character. The default value is t.

allow-null

A boolean. The default is nil.

Values

pointer

A FLI pointer to the foreign string.

length

The length of the string (including the terminating null character if there is one).

byte-count

The number of bytes in the converted string.

Description

The function convert-to-dynamic-foreign-string converts a Lisp string to a foreign string, and returns a pointer to the string and the length of the string. The memory allocation for the string and pointer is within the scope of the body of a with-dynamic-foreign-objects command.

The external-format argument is interpreted as by with-foreign-string. The names of available external formats are listed in the section "External formats" in the LispWorks User Guide and Reference Manual .

The null-terminated-p keyword specifies whether the foreign string is terminated with a null character. It defaults to t.

If allow-null is non-nil, then if string is nil a null pointer pointer is returned.

See also

allocate-dynamic-foreign-object
convert-from-foreign-string
convert-to-foreign-string
set-locale
set-locale-encodings
with-dynamic-foreign-objects
with-foreign-string
Section "External formats" in the LispWorks User Guide and Reference Manual
Calling a C function that takes an array of strings


LispWorks Foreign Language Interface User Guide and Reference Manual - 16 Feb 2015

NextPrevUpTopContentsIndex