<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>def-union</title><link rel="stylesheet" type="text/css" href="ecl.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="The ECL manual"><link rel="up" href="rn02.html" title="Aggregate Types"><link rel="prev" href="rn02re54.html" title="deref-array"><link rel="next" href="rn03.html" title="Objects"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><code class="function">def-union</code></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="rn02re54.html">Prev</a> </td><th width="60%" align="center">Aggregate Types</th><td width="20%" align="right"> <a accesskey="n" href="rn03.html">Next</a></td></tr></table><hr></div><div class="refentry" title="def-union"><a name="uffi.def-union"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p><code class="function">def-union</code> — Defines a foreign union type. <b>Macro</b></p></div><div class="refsynopsisdiv" title="Syntax"><h2>Syntax</h2><pre class="synopsis"> <code class="function">def-union</code> <em class="replaceable"><code>name &rest fields</code></em> </pre></div><div class="refsect1" title="Arguments and Values"><a name="id3005840"></a><h2>Arguments and Values</h2><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>name</code></em></span></p></td><td><p>A name of the new union type. </p></td></tr><tr><td><p><span class="term"><em class="parameter"><code>fields</code></em></span></p></td><td><p>A list of fields of the union. </p></td></tr></tbody></table></div></div><div class="refsect1" title="Description"><a name="id3005885"></a><h2>Description</h2><p> Defines a foreign union type. </p></div><div class="refsect1" title="Examples"><a name="id3005896"></a><h2>Examples</h2><pre class="screen"> (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</pre></div><div class="refsect1" title="Side Effects"><a name="id3005913"></a><h2>Side Effects</h2><p>Defines a new foreign type.</p></div><div class="refsect1" title="Affected by"><a name="id3005923"></a><h2>Affected by</h2><p>None.</p></div><div class="refsect1" title="Exceptional Situations"><a name="id3005934"></a><h2>Exceptional Situations</h2><p>None.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="rn02re54.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="rn02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="rn03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><code class="function">deref-array</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Objects</td></tr></table></div></body></html>