Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/modules.h @ 1735:5093b5ca1572
New modules loading scheme
author | Myhailo Danylenko <isbear@ukrpost.net> |
---|---|
date | Thu, 04 Mar 2010 13:03:20 +0200 |
parents | |
children | 7ee390513463 |
comparison
equal
deleted
inserted
replaced
1734:eae4a2637f2c | 1735:5093b5ca1572 |
---|---|
1 #ifndef __MCABBER_MODULES_H__ | |
2 #define __MCABBER_MODULES_H__ 1 | |
3 | |
4 #include <glib.h> | |
5 | |
6 // Module loading process looks like this: | |
7 // check, if module is loaded | |
8 // load module (+ run g_module_check_init) | |
9 // check <modulename>_info variable | |
10 // check version | |
11 // load dependencies | |
12 // run initialization callback | |
13 // module loaded | |
14 // ... | |
15 // run uninitialization callback | |
16 // unload module (+ run g_module_unload) | |
17 // unload dependencies | |
18 // module unloaded | |
19 | |
20 typedef void (*module_init_t)(void); | |
21 typedef void (*module_uninit_t)(void); | |
22 | |
23 // public module-describing structure | |
24 typedef struct { | |
25 const gchar *mcabber_version; // Contains mcabber version string, that this module is written to work with | |
26 module_init_t init; // Initialization callback to be called after all dependencies will be loaded | |
27 module_uninit_t uninit; // Uninitialization callback to be called before module unloading | |
28 const gchar **requires; // NULL-terminated list of module names, that must be loaded before this module | |
29 } module_info_t; | |
30 | |
31 const gchar *module_load(const gchar *name, gboolean manual, gboolean force); | |
32 const gchar *module_unload(const gchar *name, gboolean manual, gboolean force); | |
33 | |
34 void module_list_print(void); | |
35 | |
36 void modules_init(void); | |
37 void modules_deinit(void); | |
38 | |
39 #endif |