old files clean
[lttv.git] / ltt / branches / poly / include / 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
dc877563 9 attributes...
c5d77517 10
dc877563 11 Each lttv module must define a function named "init" with
12 the following signature. The init function may itself require other
13 modules using lttv_module_require.
c5d77517 14
dc877563 15 It should also define a function named "destroy" to free the
c5d77517 16 resources reserved during execution.
17
18 Most modules will not use the command line arguments passed as init
19 arguments. It is easier to simply register command line options
20 to be parsed by the main module. However, some modules
dc877563 21 may require an "early access" to these arguments, for example an embedded
c5d77517 22 python interpreter module which needs to know the modules written in
23 python to load. */
24
dc877563 25typedef struct _LttvModule LttvModule;
c5d77517 26
996acd92 27typedef void (*LttvModuleInit)(LttvModule *self, int argc, char **argv);
c5d77517 28
dc877563 29typedef void (*LttvModuleDestroy)();
c5d77517 30
c5d77517 31
dc877563 32/* Additional module search paths may be defined. */
c5d77517 33
dc877563 34void lttv_module_path_add(const char *name);
c5d77517 35
36
dc877563 37/* Load (or increment its reference count if already loaded) the named module.
38 The init function of the module is executed upon loading. */
c5d77517 39
dc877563 40LttvModule *lttv_module_load(const char *name, int argc, char **argv);
c5d77517 41
42
dc877563 43/* Module m depends on the named module. The named module will be loaded,
44 remembered by m as a dependent, and unloaded when m is unloaded. */
c5d77517 45
dc877563 46LttvModule *lttv_module_require(LttvModule *m, const char *name, int argc,
47 char **argv);
c5d77517 48
c5d77517 49
dc877563 50/* Decrement the reference count of the specified module and unload it if 0.
51 The destroy function of the module is executed before unloading.
52 Dependent modules are unloaded. */
c5d77517 53
dc877563 54void lttv_module_unload(LttvModule *m) ;
c5d77517 55
c5d77517 56
dc877563 57/* List the loaded modules. The returned array contains nb elements and
58 must be freed with g_free. */
c5d77517 59
dc877563 60LttvModule **lttv_module_list(guint *nb);
c5d77517 61
dc877563 62
63/* Obtain information about a module. The list of dependent module is
64 returned and must be freed with g_free. */
65
66LttvModule **lttv_module_info(LttvModule *m, const char **name,
67 guint *ref_count, guint *load_count, guint *nb_dependents);
c5d77517 68
36b3c068 69char * lttv_module_name(LttvModule *m);
c5d77517 70#endif // MODULES_H
This page took 0.040629 seconds and 4 git commands to generate.