gi-gmodule-2.0.6: GModule bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.GModule.Structs.Module

Contents

- Exported types
- Methods
  - buildPath
  - close
  - error
  - errorQuark
  - makeResident
  - name
  - supported
  - symbol

Description

The `Module` struct is an opaque data structure to represent a dynamically-loaded module. It should only be accessed via the following functions.

To ensure correct lock ordering, these functions must not be called from global constructors (for example, those using GCC’s `attribute((constructor))` attribute).

Synopsis

- newtype Module = Module (ManagedPtr Module)
- moduleBuildPath :: (HasCallStack, MonadIO m) => Maybe Text -> Text -> m Text
- moduleClose :: (HasCallStack, MonadIO m) => Module -> m Bool
- moduleError :: (HasCallStack, MonadIO m) => m Text
- moduleErrorQuark :: (HasCallStack, MonadIO m) => m Word32
- moduleMakeResident :: (HasCallStack, MonadIO m) => Module -> m ()
- moduleName :: (HasCallStack, MonadIO m) => Module -> m Text
- moduleSupported :: (HasCallStack, MonadIO m) => m Bool
- moduleSymbol :: (HasCallStack, MonadIO m) => Module -> Text -> m (Bool, Ptr ())

# Exported types

newtype Module Source #

Memory-managed wrapper type.

Constructors

Module (ManagedPtr Module) |

#### Instances

Instances details

Eq Module Source # |
Instance details Defined in GI.GModule.Structs.Module Methods (==) :: Module -> Module -> Bool Source # (/=) :: Module -> Module -> Bool Source #
BoxedPtr Module Source # |
Instance details Defined in GI.GModule.Structs.Module Methods boxedPtrCopy :: Module -> IO Module Source # boxedPtrFree :: Module -> IO () Source #
ManagedPtrNewtype Module Source # |
Instance details Defined in GI.GModule.Structs.Module Methods toManagedPtr :: Module -> ManagedPtr Module Source #

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

close, makeResident, name, symbol.

#### Getters

None.

#### Setters

None.

## buildPath

moduleBuildPath Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Maybe Text | `directory`: the directory where the module is. This can be `Nothing` or the empty string to indicate that the standard platform-specific directories will be used, though that is not recommended
-> Text | `moduleName`: the name of the module
-> m Text | Returns: the complete path of the module, including the standard library prefix and suffix. This should be freed when no longer needed

Deprecated: (Since version 2.76)Use `g_module_open()` instead with `moduleName` as thebasename of the file_name argument. See `MODULE_SUFFIX` for why.

A portable way to build the filename of a module. The platform-specific prefix and suffix are added to the filename, if needed, and the result is added to the directory, using the correct separator character.

The directory should specify the directory where the module can be found. It can be `Nothing` or an empty string to indicate that the module is in a standard platform-specific directory, though this is not recommended since the wrong module may be found.

For example, calling `moduleBuildPath` on a Linux system with a `directory` of `/lib` and a `moduleName` of "mylibrary" will return `/lib/libmylibrary.so`. On a Windows system, using `\Windows` as the directory it will return `\Windows\mylibrary.dll`.

## close

moduleClose Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Module | `module`: a `Module` to close
-> m Bool | Returns: `True` on success

Closes a module.

## error

moduleError Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Text | Returns: a string describing the last module error

Gets a string describing the last module error.

## errorQuark

moduleErrorQuark :: (HasCallStack, MonadIO m) => m Word32 Source #

No description available in the introspection data.

## makeResident

moduleMakeResident Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Module | `module`: a `Module` to make permanently resident
-> m () |

Ensures that a module will never be unloaded. Any future `moduleClose` calls on the module will be ignored.

## name

moduleName Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Module | `module`: a `Module`
-> m Text | Returns: the filename of the module

Returns the filename that the module was opened with.

If `module` refers to the application itself, "main" is returned.

## supported

moduleSupported Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Bool | Returns: `True` if modules are supported

Checks if modules are supported on the current platform.

## symbol

moduleSymbol Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Module | `module`: a `Module`
-> Text | `symbolName`: the name of the symbol to find
-> m (Bool, Ptr ()) | Returns: `True` on success

Gets a symbol pointer from a module, such as one exported by `G_MODULE_EXPORT`. Note that a valid symbol can be `Nothing`.