mkernel 0.0.1
Micro-kernel framework, everything as a module
modmgr.h File Reference

Module manager headers. More...

#include <stdint.h>
#include <ltdl.h>
#include "module.h"
Include dependency graph for modmgr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MODMGR_GETFUNCTION(m, f)   *(void**)(&f)=modmgr_getsymbol(m,#f);
 
#define MODMGR_LOAD(module, api, filename)
 

Typedefs

typedef struct modules_smodmgr_module_t
 Pointer type on private structure. More...
 

Functions

int modmgr_setpath (const char *path)
 Initialize or reset module search path. More...
 
int modmgr_addpath (const char *path)
 Add a path to the end of the module search path. More...
 
int modmgr_insertpath (const char *before, const char *path)
 Insert an higher priority search path before another one. More...
 
const char * modmgr_getpath ()
 Get the current search path list. More...
 
modmgr_module_t modmgr_load (const char *modfile)
 Load a module and call the initialization with a parameter if first usage. More...
 
void modmgr_unload (modmgr_module_t module)
 Call the unload function if last usage and tries to unload the module. More...
 
void modmgr_list ()
 Print the currently loaded modules list for debug and tracing. More...
 
void * modmgr_getsymbol (const modmgr_module_t module, const char *szSymbol)
 Resolve a module symbol, can be a function or a variable. More...
 

Detailed Description

Module manager headers.

Date
25/11/2017
Author
François Cerbelle (Fanfan), franc.nosp@m.ois@.nosp@m.cerbe.nosp@m.lle..nosp@m.net

Manage module loading with parametrized initialization, module unloading, fetching modules ABI...

Definition in file modmgr.h.

Macro Definition Documentation

◆ MODMGR_GETFUNCTION

#define MODMGR_GETFUNCTION (   m,
 
)    *(void**)(&f)=modmgr_getsymbol(m,#f);

Definition at line 32 of file modmgr.h.

◆ MODMGR_LOAD

#define MODMGR_LOAD (   module,
  api,
  filename 
)
Value:
module=modmgr_load(filename); \
api=modmgr_getsymbol(module,"module_api");
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
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

Definition at line 33 of file modmgr.h.

Typedef Documentation

◆ modmgr_module_t

typedef struct modules_s* modmgr_module_t

Pointer type on private structure.

Definition at line 42 of file modmgr.h.

Function Documentation

◆ modmgr_addpath()

int modmgr_addpath ( const char *  path)

Add a path to the end of the module search path.

Add a path to the end of the module search path.

Definition at line 141 of file modmgr.c.

Here is the caller graph for this function:

◆ modmgr_getpath()

const char * modmgr_getpath ( )

Get the current search path list.

Get the current search path list.

Definition at line 181 of file modmgr.c.

◆ modmgr_getsymbol()

void * modmgr_getsymbol ( const modmgr_module_t  module,
const char *  szSymbol 
)

Resolve a module symbol, can be a function or a variable.

Resolve a module symbol, can be a function or a variable.

Definition at line 420 of file modmgr.c.

◆ modmgr_insertpath()

int modmgr_insertpath ( const char *  before,
const char *  path 
)

Insert an higher priority search path before another one.

Insert an higher priority search path before another one.

Definition at line 161 of file modmgr.c.

◆ modmgr_list()

void modmgr_list ( )

Print the currently loaded modules list for debug and tracing.

Print the currently loaded modules list for debug and tracing.

Definition at line 379 of file modmgr.c.

Here is the caller graph for this function:

◆ modmgr_load()

modmgr_module_t modmgr_load ( const char *  modfile)

Load a module and call the initialization with a parameter if first usage.

Load a module and call the initialization with a parameter if first usage.

Todo:
critical section

Definition at line 191 of file modmgr.c.

◆ modmgr_setpath()

int modmgr_setpath ( const char *  path)

Initialize or reset module search path.

Initialize or reset module search path.

Definition at line 125 of file modmgr.c.

Here is the caller graph for this function:

◆ modmgr_unload()

void modmgr_unload ( modmgr_module_t  module)

Call the unload function if last usage and tries to unload the module.

Call the unload function if last usage and tries to unload the module.

Definition at line 306 of file modmgr.c.

Here is the caller graph for this function: