mkernel 0.0.1
Micro-kernel framework, everything as a module
modmgr.h
Go to the documentation of this file.
1
20#ifndef __MODMGR_H__
21#define __MODMGR_H__
22
23#ifdef HAVE_CONFIG_H
24#include "config.h"
25#endif
26
27#include <stdint.h>
28#include <ltdl.h>
29
30#include "module.h"
31
32#define MODMGR_GETFUNCTION(m,f) *(void**)(&f)=modmgr_getsymbol(m,#f);
33#define MODMGR_LOAD(module,api,filename) \
34 module=modmgr_load(filename); \
35 api=modmgr_getsymbol(module,"module_api");
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
42typedef struct modules_s *modmgr_module_t;
43
45int modmgr_setpath (const char* path);
46
48int modmgr_addpath (const char* path);
49
51int modmgr_insertpath (const char* before, const char* path);
52
54const char* modmgr_getpath ();
55
57modmgr_module_t modmgr_load(const char* modfile);
58
61
63void modmgr_list();
64
66void* modmgr_getsymbol(const modmgr_module_t module, const char* szSymbol);
67
68#ifdef __cplusplus
69}
70#endif
71
72#endif /* __MODMGR_H__ */
int modmgr_setpath(const char *path)
Initialize or reset module search path.
Definition: modmgr.c:125
struct modules_s * modmgr_module_t
Pointer type on private structure.
Definition: modmgr.h:42
void * modmgr_getsymbol(const modmgr_module_t module, const char *szSymbol)
Resolve a module symbol, can be a function or a variable.
Definition: modmgr.c:420
int modmgr_insertpath(const char *before, const char *path)
Insert an higher priority search path before another one.
Definition: modmgr.c:161
void modmgr_list()
Print the currently loaded modules list for debug and tracing.
Definition: modmgr.c:379
modmgr_module_t modmgr_load(const char *modfile)
Load a module and call the initialization with a parameter if first usage.
Definition: modmgr.c:191
int modmgr_addpath(const char *path)
Add a path to the end of the module search path.
Definition: modmgr.c:141
void modmgr_unload(modmgr_module_t module)
Call the unload function if last usage and tries to unload the module.
Definition: modmgr.c:306
const char * modmgr_getpath()
Get the current search path list.
Definition: modmgr.c:181
Internal ABI shared by all modules with modmgr.
Module list item structure.
Definition: modmgr.c:42