Name

def-union — Defines a foreign union type. Macro

Syntax

     def-union name &rest fields
    

Arguments and Values

name

A name of the new union type.

fields

A list of fields of the union.

Description

Defines a foreign union type.

Examples

(def-union test-union
  (a-char :char)
  (an-int :int))

(let ((u (allocate-foreign-object 'test-union)))
  (setf (get-slot-value u 'test-union 'an-int) (+ 65 (* 66 256)))
  (prog1 
     (ensure-char-character (get-slot-value u 'test-union 'a-char))
   (free-foreign-object u)))
=> #\A

Side Effects

Defines a new foreign type.

Affected by

None.

Exceptional Situations

None.