ModuleProtocol
public protocol 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 ModuleProtocol
protocol exposes the methods and properties of an underlying GModule
instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see Module
.
Alternatively, use ModuleRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GModule
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
_ptr
Default implementationTyped pointer to the underlying
GModule
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GModule
instance.Declaration
Swift
var _ptr: UnsafeMutablePointer<GModule>! { get }
-
Required Initialiser for types conforming to
ModuleProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
close()
Extension methodCloses a module.
Declaration
Swift
@inlinable func close() -> Bool
-
makeResident()
Extension methodEnsures that a module will never be unloaded. Any future
g_module_close()
calls on the module will be ignored.Declaration
Swift
@inlinable func makeResident()
-
name()
Extension methodReturns the filename that the module was opened with.
If
module
refers to the application itself, “main” is returned.Declaration
Swift
@inlinable func name() -> String!
-
symbol(symbolName:
Extension methodsymbol: ) Gets a symbol pointer from a module, such as one exported by
G_MODULE_EXPORT
. Note that a valid symbol can benil
.Declaration
Swift
@inlinable func symbol(symbolName: UnsafePointer<gchar>!, symbol: UnsafeMutablePointer<gpointer?>?) -> Bool