GLib.Error.domain_register_static
Description: Reference for GLib.Error.domain_register_static

### Function

# GLib Errordomain_register_static

since: 2.68

#### Declaration

    GQuark
    g_error_domain_register_static (
      const char* error_type_name,
      gsize error_type_private_size,
      GErrorInitFunc error_type_init,
      GErrorCopyFunc error_type_copy,
      GErrorClearFunc error_type_clear
    )

#### Description

This function registers an extended `GError` domain.

`error_type_name` should not be freed. `error_type_private_size` must be greater than 0.

`error_type_init` receives an initialized `GError` and should then initialize the private data.

`error_type_copy` is a function that receives both original and a copy `GError` and should copy the fields of the private error data. The standard `GError` fields are already handled.

`error_type_clear` receives the pointer to the error, and it should free the fields of the private error data. It should not free the struct itself though.

Normally, it is better to use G_DEFINE_EXTENDED_ERROR(), as it already takes care of passing valid information to this function.

Available since: 2.68

#### Parameters

`error_type_name`

  Type: `const char*`

  Static string to create a `GQuark` from.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`error_type_private_size`

  Type: `gsize`

  Size of the private error data in bytes.

`error_type_init`

  Type: `GErrorInitFunc`

  Function initializing fields of the private error data.

`error_type_copy`

  Type: `GErrorCopyFunc`

  Function copying fields of the private error data.

`error_type_clear`

  Type: `GErrorClearFunc`

  Function freeing fields of the private error data.

#### Return value

Type: `GQuark`

`GQuark` representing the error domain.