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


4.12.9 with-boxed-foreign-array

— Macro: with-boxed-foreign-array
     (with-foreign-boxed-array (n-var array-var type values-seq) &body body)
n-var
A variable that will contain the count of items in values-seq
array-var
A variable that will contain the pointer to array of C structures
type
A symbol that specifies the type of GBoxed structure
values-seq
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.

Examples:

     (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)))