Previous: copy-boxed-slots-to-foreign, Up: GBoxed

12.9 with-boxed-foreign-array

— Macro: with-boxed-foreign-array
     (with-foreign-boxed-array (n-var array-var type values-seq) &body body)
A variable that will contain the count of items in values-seq
A variable that will contain the pointer to array of C structures
A symbol that specifies the type of GBoxed structure
An expression that returns the sequence of structures (list or array)

Evaluates the body within the scope and extent of foreign array that contains copies of structures that are returned by values-seq. Binds n-var to the length of values-seq, array-var to the pointer to array of structures.


     (defcfun gdk-region-polygon (g-boxed-foreign region :return)
       (points :pointer)
       (n-points :int)
       (fill-rule gdk-fill-rule))
     (defun region-from-polygon (points fill-rule)
       (with-foreign-boxed-array (n pts point points)
         (gdk-region-polygon pts n fill-rule)))