Next: , Previous: make-pointer, Up: Pointers


mem-aptr

Syntax

— Accessor: mem-aptr ptr type &optional (index 0)

Arguments and Values

ptr
A foreign pointer.
type
A foreign type.
index
An integer.
new-value
A Lisp value compatible with type.

Description

The mem-aptr function finds the pointer to an element of the array.

  (mem-aptr ptr type n)
   
  ;; is identical to:
   
  (inc-pointer ptr (* n (foreign-type-size type)))

Examples

  CFFI> (with-foreign-string (str "Hello, foreign world!")
          (mem-aptr str :char 6))
  => #.(SB-SYS:INT-SAP #X0063D4B6)