GObject.type_ensure
Description: Reference for GObject.type_ensure

### Function

# GObjecttype_ensure

since: 2.34

#### Declaration [src]

    void
    g_type_ensure (
      GType type
    )

#### Description [src]

Ensures that the indicated `type` has been registered with the type system, and its _class_init() method has been run.

Typically, calling the type’s `_get_type()` method (or using the corresponding macro) will take care of this. In situations where a type is looked up dynamically, however, you may need to explicitly call `g_type_ensure()` to ensure expected types are registered before the first lookup. This can happen when using custom widgets from a GTK `.ui` file, for example.

Historically, `_get_type()` methods have sometimes been marked as `G_GNUC_CONST`. This is incorrect, as the first call to a `_get_type()` method has side-effects. These annotations should be removed, as they can cause code to be optimized out in unexpected ways by the compiler.

Available since: 2.34

#### Parameters

`type`

  Type: `GType`

  A `GType`.