Next: , Previous: define-g-boxed-variant-cstruct, Up: GBoxed

12.3 define-g-boxed-opaque

— Macro: define-g-boxed-opaque
     (define-g-boxed-opaque name g-type-name &key alloc)
A name of boxed type
A string; the name of GType
A form that when evaluated produces a pointer to newly allocated structure. This pointer should be copiable with g_boxed_copy and freeable with g_boxed_free function.

Defines a opaque boxed structure. A class named name is defined as a subclass of g-boxed-opaque class. Instances of this class contain pointers to corresponding structures. An :after method for initialize-instance generic function is defined that speciales on class name. This method either accepts a :pointer initarg or evaluates alloc form if :pointer is not specified; the resulting pointer is saved in instance; finalizer is registered to free the pointer when the garbage collectors deletes this object.


     (defcfun gtk-tree-path-new :pointer)
     (define-g-boxed-opaque tree-path "GtkTreePath"
       :alloc (gtk-tree-path-new))