Module

open class Module : ModuleProtocol

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

The Module type acts as an owner of an underlying GModule instance. It provides the methods that can operate on this data type through ModuleProtocol conformance. Use Module as a strong reference or owner of a GModule instance.

  • ptr
    Untyped pointer to the underlying `GModule` instance.
    

    For type-safe access, use the generated, typed pointer _ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!
  • Designated initialiser from the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the Module instance.

    Declaration

    Swift

    @inlinable
    public init(_ op: UnsafeMutablePointer<GModule>)

    Parameters

    op

    pointer to the underlying object

  • Designated initialiser from a constant pointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the Module instance.

    Declaration

    Swift

    @inlinable
    public init(_ op: UnsafePointer<GModule>)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from a non-mutating gpointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the Module instance.

    Declaration

    Swift

    @inlinable
    public init!(gpointer op: gpointer?)

    Parameters

    op

    gpointer to the underlying object

  • Optional initialiser from a non-mutating gconstpointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the Module instance.

    Declaration

    Swift

    @inlinable
    public init!(gconstpointer op: gconstpointer?)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from a constant pointer to the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the Module instance.

    Declaration

    Swift

    @inlinable
    public init!(_ op: UnsafePointer<GModule>?)

    Parameters

    op

    pointer to the underlying object

  • Optional initialiser from the underlying C data type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the Module instance.

    Declaration

    Swift

    @inlinable
    public init!(_ op: UnsafeMutablePointer<GModule>?)

    Parameters

    op

    pointer to the underlying object

  • Designated initialiser from the underlying C data type. GModule does not allow reference counting, so despite the name no actual retaining will occur. i.e., ownership is transferred to the Module instance.

    Declaration

    Swift

    @inlinable
    public init(retaining op: UnsafeMutablePointer<GModule>)

    Parameters

    op

    pointer to the underlying object

  • Reference intialiser for a related type that implements ModuleProtocol GModule does not allow reference counting.

    Declaration

    Swift

    @inlinable
    public init<T>(_ other: T) where T : ModuleProtocol

    Parameters

    other

    an instance of a related type that implements ModuleProtocol

  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ModuleProtocol.

    Declaration

    Swift

    @inlinable
    public init<T>(cPointer p: UnsafeMutablePointer<T>)

    Parameters

    cPointer

    pointer to the underlying object

  • Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ModuleProtocol.

    Declaration

    Swift

    @inlinable
    public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)

    Parameters

    cPointer

    pointer to the underlying object

  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ModuleProtocol.

    Declaration

    Swift

    @inlinable
    public init(raw p: UnsafeRawPointer)

    Parameters

    p

    raw pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ModuleProtocol.

    Declaration

    Swift

    @inlinable
    public init(retainingRaw raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ModuleProtocol.

    Declaration

    Swift

    @inlinable
    public required init(raw p: UnsafeMutableRawPointer)

    Parameters

    p

    mutable raw pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ModuleProtocol.

    Declaration

    Swift

    @inlinable
    public init(retainingRaw raw: UnsafeMutableRawPointer)

    Parameters

    raw

    mutable raw pointer to the underlying object

  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ModuleProtocol.

    Declaration

    Swift

    @inlinable
    public init(opaquePointer p: OpaquePointer)

    Parameters

    p

    opaque pointer to the underlying object

  • Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to ModuleProtocol.

    Declaration

    Swift

    @inlinable
    public init(retainingOpaquePointer p: OpaquePointer)

    Parameters

    p

    opaque pointer to the underlying object

  • A thin wrapper function around g_module_open_full()

    Declaration

    Swift

    @inlinable
    public static func open(fileName: UnsafePointer<gchar>? = nil, flags: ModuleFlags) -> Module!
  • Opens a module. If the module has already been opened, its reference count is incremented.

    First of all g_module_open_full() tries to open file_name as a module. If that fails and file_name has the “.la”-suffix (and is a libtool archive) it tries to open the corresponding module. If that fails and it doesn’t have the proper module suffix for the platform (G_MODULE_SUFFIX), this suffix will be appended and the corresponding module will be opened. If that fails and file_name doesn’t have the “.la”-suffix, this suffix is appended and g_module_open_full() tries to open the corresponding module. If eventually that fails as well, nil is returned.

    Declaration

    Swift

    @inlinable
    public static func openFull(fileName: UnsafePointer<gchar>? = nil, flags: ModuleFlags) throws -> Module!