This repository has been archived by the owner on Apr 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGModule-2.0.d.ts
152 lines (143 loc) · 5.21 KB
/
GModule-2.0.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/** Generated with https://github.com/Gr3q/GIR2TS - If possible do not modify. */
declare namespace imports.gi.GModule {
export interface ModuleInitOptions {}
/**
* The #GModule struct is an opaque data structure to represent a
* [dynamically-loaded module][glib-Dynamic-Loading-of-Modules].
* It should only be accessed via the following functions.
*/
interface Module {}
class Module {
public constructor(options?: Partial<ModuleInitOptions>);
/**
* Closes a module.
* @returns %TRUE on success
*/
public close(): boolean;
/**
* Ensures that a module will never be unloaded.
* Any future {@link GModule.close} calls on the module will be ignored.
*/
public make_resident(): void;
/**
* Returns the filename that the module was opened with.
*
* If #module refers to the application itself, "main" is returned.
* @returns the filename of the module
*/
public name(): string;
/**
* Gets a symbol pointer from a module, such as one exported
* by #G_MODULE_EXPORT. Note that a valid symbol can be %NULL.
* @param symbol_name the name of the symbol to find
* @returns %TRUE on success
*
* returns the pointer to the symbol value
*/
public symbol(symbol_name: string): [ boolean, any | null ];
}
/**
* Errors returned by {@link GModule.open_full}.
*/
enum ModuleError {
/**
* there was an error loading or opening a module file
*/
FAILED = 0,
/**
* a module returned an error from its {@link `g.module_check_init}` function
*/
CHECK_FAILED = 1
}
/**
* Flags passed to {@link GModule.open}.
* Note that these flags are not supported on all platforms.
*/
enum ModuleFlags {
/**
* specifies that symbols are only resolved when
* needed. The default action is to bind all symbols when the module
* is loaded.
*/
LAZY = 1,
/**
* specifies that symbols in the module should
* not be added to the global name space. The default action on most
* platforms is to place symbols in the module in the global name space,
* which may cause conflicts with existing symbols.
*/
LOCAL = 2,
/**
* mask for all flags.
*/
MASK = 3
}
/**
* Specifies the type of the module initialization function.
* If a module contains a function named {@link GModule.check_init} it is called
* automatically when the module is loaded. It is passed the #GModule structure
* and should return %NULL on success or a string describing the initialization
* error.
*/
interface ModuleCheckInit {
/**
* Specifies the type of the module initialization function.
* If a module contains a function named {@link GModule.check_init} it is called
* automatically when the module is loaded. It is passed the #GModule structure
* and should return %NULL on success or a string describing the initialization
* error.
* @param module the #GModule corresponding to the module which has just been loaded
* @returns %NULL on success, or a string describing the initialization error
*/
(module: Module): string;
}
/**
* Specifies the type of the module function called when it is unloaded.
* If a module contains a function named {@link GModule.unload} it is called
* automatically when the module is unloaded.
* It is passed the #GModule structure.
*/
interface ModuleUnload {
/**
* Specifies the type of the module function called when it is unloaded.
* If a module contains a function named {@link GModule.unload} it is called
* automatically when the module is unloaded.
* It is passed the #GModule structure.
* @param module the #GModule about to be unloaded
*/
(module: Module): void;
}
/**
* 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 %NULL 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 {@link GModule.build_path} on a Linux system with a
* #directory of `/lib` and a #module_name of "mylibrary" will return
* `/lib/libmylibrary.so`. On a Windows system, using `\Windows` as the
* directory it will return `\Windows\mylibrary.dll`.
* @param directory the directory where the module is. This can be
* %NULL or the empty string to indicate that the standard platform-specific
* directories will be used, though that is not recommended
* @param module_name the name of the module
* @returns the complete path of the module, including the standard library
* prefix and suffix. This should be freed when no longer needed
*/
function module_build_path(directory: string | null, module_name: string): string;
/**
* Gets a string describing the last module error.
* @returns a string describing the last module error
*/
function module_error(): string;
function module_error_quark(): GLib.Quark;
/**
* Checks if modules are supported on the current platform.
* @returns %TRUE if modules are supported
*/
function module_supported(): boolean;
}