Next: , Previous: , Up: Foreign Types   [Contents][Index]


foreign-slot-offset

foreign-slot-offset

Syntax

Function: foreign-slot-offset type slot-name ⇒ offset

Arguments and Values

type

A foreign struct type.

slot-name

A symbol.

offset

An integer.

Description

The function foreign-slot-offset returns the offset in bytes of a slot in a foreign struct type.

Examples

  (defcstruct timeval
    (tv-secs :long)
    (tv-usecs :long))
   
  CFFI> (foreign-slot-offset '(:struct timeval) 'tv-secs)
  ⇒ 0
  CFFI> (foreign-slot-offset '(:struct timeval) 'tv-usecs)
  ⇒ 4

See Also

defcstruct
foreign-slot-names
foreign-slot-pointer
foreign-slot-value