Name

deref-pointer — Deferences a pointer.

Macro

(deref-pointer ptr type)

ptr

A pointer to a foreign object.

type

A foreign type of the object being pointed to.

returns

The value of the object where the pointer points.

Description

Returns the object to which a pointer points.

Examples

      (let ((intp (allocate-foreign-object :int)))
      (setf (deref-pointer intp :int) 10)
      (prog1
      (deref-pointer intp :int)
      (free-foreign-object intp)))
      => 10

Notes

The TYPE argument is ignored for CL implementations other than AllegroCL. If you want to cast a pointer to another type use WITH-CAST-POINTER together with DEREF-POINTER/DEREF-ARRAY.

Side Effects

None.

Affected by

None.

Exceptional Situations

None.