set_free_func
Description:
Example: Set a free func:
public static int main (string[] args) {
// PtrArray array = new PtrArray.with_free_func (GLib.free);
PtrArray array = new PtrArray ();
array.set_free_func (GLib.free);
array.add ("first entry".dup ());
array.add ("second entry".dup ());
array.add ("third entry".dup ());
// Output:
// ``first entry``
// ``second entry``
// ``third entry``
array.foreach ((ptr) => {
print ("%s\n", (string) ptr);
});
return 0;
}
valac --pkg glib-2.0 GLib.PtrArray.set_free_func.vala