Package: cffi

Macro incf-pointer

Lambda List

incf-pointer (place &optional offset env)

Arguments

place -- A setf place.
offset -- An integer.

Return Value

A foreign pointer.

Details

The incf-pointer macro takes the foreign pointer from place and creates a new pointer incremented by offset bytes and which is stored in place.

Examples

  CFFI> (defparameter *two-words* (foreign-string-alloc "Common Lisp"))
  => *TWO-WORDS*
  CFFI> (defparameter *one-word* *two-words*)
  => *ONE-WORD*
  CFFI> (incf-pointer *one-word* 7)
  => #.(SB-SYS:INT-SAP #X00600457)
  CFFI> (foreign-string-to-lisp *one-word*)
  => "Lisp"
  CFFI> (foreign-string-to-lisp *two-words*)
  => "Common Lisp"  
pointerp
 

See also