Preliminary add of header files
[lttv.git] / ltt / branches / poly / lttv / module.h
CommitLineData
c5d77517 1#ifndef MODULES_H
2#define MODULES_H
3
4#include <gmodule.h>
5
6/* lttv modules are shared object files, to be loaded dynamically, which
7 interact with the main module to provide additional capabilities. They
8 typically register hooks to be called at various places, read and add
9 global or trace attributes, and add menu items and tabbed windows to the
10 graphical user interface. Both the hooks lists and the menus and windows
11 are accessed as global attributes. */
12
13
14/* Each lttv module must define a function named "init" with
15 the following signature. The init function may itself load pre-requisite
16 modules using lttv_module_load.
17
18 It should also define a function named "destroy", which free the
19 resources reserved during execution.
20
21 Most modules will not use the command line arguments passed as init
22 arguments. It is easier to simply register command line options
23 to be parsed by the main module. However, some modules
24 may require an "early access" to these arguments, for example a embedded
25 python interpreter module which needs to know the modules written in
26 python to load. */
27
28/* Initial draft by Michel Dagenais May 2003
29 * Reworked by Mathieu Desnoyers, May 2003
30 */
31
32/* index_standalone is the index of the module in the modulesStanalone array.
33 * If the module is only loaded "DEPENDANT", index is -1.
34 */
35
36typedef struct lttv_module_info_ {
37 GModule *module;
38 char *name;
39 char *directory;
40 char *pathname;
41 guint ref_count;
42 gint index_standalone;
43} lttv_module_info;
44
45/* Loading type of modules :
46 * STANDALONE : the program takes care of unloading the moduels
47 * DEPENDANT : The module that load this module is required to unload
48 * it in it's destroy function.
49 */
50
51typedef enum _loadtype
52{ STANDALONE, DEPENDANT
53} loadtype;
54
55typedef void (*lttv_module_load_init)(int argc, char **argv) ;
56
57
58/* Load (if not already loaded) the named module. The init function of the
59 module is executed upon loading. */
60
61lttv_module_info *lttv_module_load(const char *name, int argc, char **argv,loadtype);
62
63
64
65/* Unload (if already loaded) the named module. The destroy function of the
66 module is executed before unloading. */
67
68typedef void (*lttv_module_unload_destroy)() ;
69
70int lttv_module_unload_pathname(const char *pathname,loadtype) ;
71
72int lttv_module_unload_name(const char *name,loadtype) ;
73
74int lttv_module_unload(lttv_module_info *moduleInfo,loadtype);
75
76/* Unload all the modules */
77void lttv_module_unload_all();
78
79/* Additional module search paths may be defined. */
80
81void lttv_module_path_add(const char *name);
82
83#endif // MODULES_H
This page took 0.024365 seconds and 4 git commands to generate.