### Method

# GIRepository Repository require

since: 2.80

#### Declaration [src]

    GITypelib*
    gi_repository_require (
      GIRepository* repository,
      const char* namespace_,
      const char* version,
      GIRepositoryLoadFlags flags,
      GError** error
    )

#### Description [src]

Force the namespace `namespace_` to be loaded if it isn’t already.

If `namespace_` is not loaded, this function will search for a `.typelib` file using the repository search path. In addition, a version `version` of namespace may be specified. If `version` is not specified, the latest will be used.

Available since: 2.80

#### Parameters

`namespace_`

  Type: `const char*`

  GI namespace to use, e.g. `Gtk`.

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

`version`

  Type: `const char*`

  Version of namespace, may be `NULL` for latest.

  The argument can be `NULL`.
  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`flags`

  Type: `GIRepositoryLoadFlags`

  Set of `GIRepositoryLoadFlags`, may be 0.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `GITypelib`

A pointer to the `GITypelib` if successful, `NULL` otherwise.

The returned data is owned by the instance.