FmModule

FmModule — Simple external modules handler.

Synopsis

#define             CHECK_MODULES                       (...)
#define             FM_DEFINE_MODULE                    (_type_,
                                                         _name_)
#define             FM_MODULE_DEFINE_TYPE               (_type_,
                                                         _struct_,
                                                         _minver_)
gboolean            (*FmModuleInitCallback)             (const char *key,
                                                         gpointer init_data,
                                                         int version);
gboolean            fm_module_is_in_use                 (const char *type,
                                                         const char *name);
void                fm_module_register_type             (const char *type,
                                                         int minver,
                                                         int maxver,
                                                         FmModuleInitCallback cb);
void                fm_module_unregister_type           (const char *type);
gboolean            fm_modules_add_directory            (const char *path);
void                fm_modules_load                     (void);

Description

include: libfm/fm.h

This implementation allows applications to use external modules and select which ones application wants to use (from none to all).

The naming scheme in examples below is strict. Replace "dummy" part in them with your real name when you trying to use those examples. Those strict example names are:

  • FM_MODULE_dummy_VERSION

  • fm_module_init_dummy

  • fm_module_callback_dummy

  • fm_module_register_dummy

To use modules application should make few things. Let say, there is some FmDummyWidget which wants to use "dummy" type of modules. First thing application should do is create a header file which all modules of that type should include:

Example 1. Sample of fm-dummy.h

1
2
3
4
5
6
7
8
9
10
11
12