RT-Thread RTOS  1.0.0
An open source embedded real-time operating system
Application Module

Data Structures

struct  rt_module

Functions

rt_module_t rt_module_load (const char *name, void *module_ptr)
rt_err_t rt_module_unload (rt_module_t module)
rt_module_t rt_module_open (const char *filename)
rt_module_t rt_module_self (void)
rt_err_t rt_module_set (rt_module_t module)
rt_module_t rt_module_find (const char *name)
void rt_module_load_sethook (void(*hook)(rt_module_t module))
void rt_module_unload_sethook (void(*hook)(rt_module_t module))

Detailed Description

Application Module is implemented as dynamic object loader, but it can handle the dependences relationship between application and dynamic library, moreover, it also can handle the kernel object destroy and memory release issue when application (abnormally) exit.


Function Documentation

rt_module_t rt_module_load ( const char *  name,
void *  module_ptr 
)

This function will load a module from memory and create a thread for it

Parameters:
namethe name of module, which shall be unique
module_ptrthe memory address of module image
Returns:
the module object

This function will unload a module from memory and release resources

Parameters:
modulethe module to be unloaded
Returns:
the operation status, RT_EOK on OK; -RT_ERROR on error
rt_module_t rt_module_open ( const char *  path)

This function will load a module from a file

Parameters:
paththe full path of application module
Returns:
the module object

This function will return self module object

Returns:
the self module object

This function will set current module object

Returns:
RT_EOK
rt_module_t rt_module_find ( const char *  name)

This function will find the specified module.

Parameters:
namethe name of module finding
Returns:
the module
void rt_module_load_sethook ( void(*)(rt_module_t module)  hook)

This function will set a hook function, which will be invoked when module be loaded to system.

Parameters:
hookthe hook function
void rt_module_unload_sethook ( void(*)(rt_module_t module)  hook)

This function will set a hook function, which will be invoked when module be unloaded from system.

Parameters:
hookthe hook function
 All Data Structures Variables