Next Prev Up Top Contents Index

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 command.

Package

fli

Signature

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

Arguments

string

A Lisp string.

external-format

A keyword specifying the format to be used for the foreign string.

null-terminated-p

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

Values

pointer

An FLI pointer to the foreign string.

length

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

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 keyword is used to specify the format of the foreign string. It defaults to a format appropriate for C string of type char* . For Unicode encoded strings, specify :unicode . If you want to pass a string to the Win32 API, known as STR in the Win32 API terminology, specify *multibyte-code-page-ef* , which is a variable holding the external format corresponding to the current Windows multi-byte code page.

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

See Also

allocate-dynamic-foreign-object

convert-from-foreign-string

with-dynamic-foreign-objects

with-foreign-string


LispWorks Foreign Language Interface User Guide and Reference Manual - 14 Dec 2001

Next Prev Up Top Contents Index