Next: , Previous: , Up: Top   [Contents][Index]


6 Memory Access

Accessor: %mem-ref ptr type &optional offset

Dereference a pointer offset bytes from ptr to an object for reading (or writing when used with setf) of built-in type type.

Example

  ;; An impractical example, since time returns the time as well,
  ;; but it demonstrates %MEM-REF. Better (simple) examples wanted!
  (with-foreign-pointer (p (foreign-type-size :time))
    (foreign-funcall "time" :pointer p :time)
    (%mem-ref p :time))