Previous: defcvar, Up: Variables


get-var-pointer

Syntax

— Function: get-var-pointer symbol ⇒ pointer

Arguments and Values

symbol
A symbol denoting a foreign variable defined with defcvar.
pointer
A foreign pointer.

Description

The function get-var-pointer will return a pointer to the foreign global variable symbol previously defined with defcvar.

Examples

  CFFI> (defcvar "errno" :int :read-only t)
  => *ERRNO*
  CFFI> *errno*
  => 25
  CFFI> (get-var-pointer '*errno*)
  => #<A Mac Pointer #xA0008130>
  CFFI> (mem-ref * :int)
  => 25

See Also

defcvar