Function Macro

GObjectDEFINE_BOXED_TYPE

Declaration [src]

#define G_DEFINE_BOXED_TYPE (
  TypeName,
  type_name,
  copy_func,
  free_func
)

Description [src]

A convenience macro for defining a new custom boxed type.

Using this macro is the recommended way of defining new custom boxed types, over calling g_boxed_type_register_static() directly. It defines a type_name_get_type() function which will return the newly defined GType, enabling lazy instantiation.

G_DEFINE_BOXED_TYPE (MyStruct, my_struct, my_struct_copy, my_struct_free)

void
foo ()
{
  GType type = my_struct_get_type ();
  // ... your code ...
}
Available since:2.26

Parameters

TypeName -
 

The name of the new type, in Camel case.

type_name -
 

The name of the new type, in lowercase, with words separated by _

copy_func -
 

The GBoxedCopyFunc for the new type.

free_func -
 

The GBoxedFreeFunc for the new type.