r1822: *** empty log message ***
[uffi.git] / doc / notes.sgml
index 8dfb3e5906178cb2e57dffe47857bd799ddd2d98..c4e86036a66c38184e5fd0ef2df771bf2dcbd997 100644 (file)
     </sect2>
     <sect2>
       <title>Cross-Implementation Optimization</title>
-<para>To fully optimize across platforms, both explicit type information
-must be passed to dereferencing of pointers and arrays. Though this
-optimization only helps with &acl;, &uffi; is designed to require this
-type information be passed the dereference functions. Second, declarations
-of type should be made in functions, structures, and classes where
-foreign objects will be help. This will optimize access for &lw;
-</para>
-</sect2>
+      <para>
+       To fully optimize across platforms, both explicit type
+       information must be passed to dereferencing of pointers and
+       arrays. Though this optimization only helps with &acl;, &uffi;
+       is designed to require this type information be passed the
+       dereference functions. Second, declarations of type should be
+       made in functions, structures, and classes where foreign
+       objects will be help. This will optimize access for &lw;
+      </para>
+      <para>
+       Here is an example that should both methods being used for
+       maximum cross-implementation optimization:
+       <programlisting>
+(uffi:def-type the-struct-type-def the-struct-type)
+(let ((a-foreign-struct (allocate-foreign-object 'the-struct-type)))
+  (declare 'the-struct-type-def a-foreign-struct)
+  (get-slot-value a-foreign-struct 'the-struct-type 'field-name))
+       </programlisting>
+      </para>
+    </sect2>
   </sect1>
 
 </chapter>