Next Previous Up Top Contents Index

5 Function and Macro Reference

convert-to-dynamic-foreign-string

Function

Summary

Converts a Lisp string to a foreign string within the scope of the body of awith-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

Ift, the foreign string terminates with a null character. The default value ist.

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 functionconvert-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 awith-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 typechar*. For Unicode encoded strings, specify:unicode. If you want to pass a string to the Win32 API, known asSTR 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 tot.
See Also

allocate-dynamic-foreign-object
convert-from-foreign-string
with-dynamic-foreign-objects
with-foreign-string

LispWorks Foreign Language Interface - 12 Oct 1998

Next Previous Up Top Contents Index

Generated with Harlequin WebMaker