Previous: , Up: Strings   [Contents][Index]


with-foreign-pointer-as-string

with-foreign-pointer-as-string

Syntax

Macro: with-foreign-pointer-as-string (var size &optional size-var &rest args) &body body ⇒ string

Arguments and Values

var

A symbol.

string

A Lisp string.

body

List of forms to be executed.

Description

The with-foreign-pointer-as-string macro is similar to with-foreign-pointer except that var is used as the returned value of an implicit progn around body, after being converted to a Lisp string using the provided args.

Examples

  CFFI> (with-foreign-pointer-as-string (str 6 str-size :encoding :ascii)
          (lisp-string-to-foreign "Hello, foreign world!" str str-size))
  ⇒ "Hello"

See Also

foreign-string-alloc
with-foreign-string