since: 2.70

Declaration [src]

g_module_open_full (
  const gchar* file_name,
  GModuleFlags flags,
  GError** error

Description [src]

Opens a module. If the module has already been opened, its reference count is incremented. If not, the module is searched using file_name.

Since 2.76, the search order/behavior is as follows:

  1. If file_name exists as a regular file, it is used as-is; else
  2. If file_name doesn’t have the correct suffix and/or prefix for the platform, then possible suffixes and prefixes will be added to the basename till a file is found and whatever is found will be used; else
  3. If file_name doesn’t have the “.la”-suffix, “.la” is appended. Either way, if a matching .la file exists (and is a libtool archive) the libtool archive is parsed to find the actual file name, and that is used.

If, at the end of all this, we have a file path that we can access on disk, it is opened as a module. If not, file_name is attempted to be opened as a module verbatim in the hopes that the system implementation will somehow be able to access it. If that is not possible, NULL is returned.

Note that this behaviour was different prior to 2.76, but there is some overlap in functionality. If backwards compatibility is an issue, kindly consult earlier GModule documentation for the prior search order/behavior of file_name.

Available since: 2.70

This function is not directly available to language bindings.



Type: const gchar*

The name or path to the file containing the module, or NULL to obtain a GModule representing the main program itself.

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

Type: GModuleFlags

The flags used for opening the module. This can be the logical OR of any of the GModuleFlags.


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 left initialized to NULL by the function 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: GModule

A GModule on success, or NULL on failure.

The data is owned by the called function.