mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-10-07 00:59:00 +08:00
construct module symbol table
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1053 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -39,15 +39,11 @@ static void open_btn_onbutton(rtgui_widget_t* widget, struct rtgui_event* event)
|
||||
|
||||
rt_memset(name, 0, sizeof(name));
|
||||
|
||||
/* 获得图像的类型 */
|
||||
/* 获得应用模块的类型 */
|
||||
if (rt_strstr(path, ".mo") != RT_NULL || rt_strstr(path, ".so") != RT_NULL)
|
||||
{
|
||||
rt_memcpy(name, "mod", 4);
|
||||
rt_module_open(path);
|
||||
}
|
||||
|
||||
/* 如果图像文件有效,创建相应的rtgui_image对象 */
|
||||
if (name[0] != '\0')
|
||||
rt_module_load_from_file(name, path);
|
||||
}
|
||||
|
||||
/* 删除 文件列表 视图 */
|
||||
|
||||
@@ -392,6 +392,13 @@ struct rt_module
|
||||
rt_list_t module_page; /* module using page */
|
||||
void* page_node_pool;
|
||||
|
||||
/* module symbol table */
|
||||
rt_uint32_t nsym;
|
||||
struct rt_module_symtab *symtab;
|
||||
|
||||
/* reference count */
|
||||
rt_uint32_t nref;
|
||||
|
||||
/* object in this module, module object is the last basic object type */
|
||||
struct rt_object_information module_object[RT_Object_Class_Module];
|
||||
};
|
||||
|
||||
+1
-1
@@ -308,8 +308,8 @@ rt_err_t rt_device_control(rt_device_t dev, rt_uint8_t cmd, void* arg);
|
||||
*/
|
||||
|
||||
rt_module_t rt_module_load(const rt_uint8_t* name, void* module_ptr);
|
||||
rt_module_t rt_module_load_from_file(const rt_uint8_t* name, const char* filename);
|
||||
rt_err_t rt_module_unload(rt_module_t module);
|
||||
rt_module_t rt_module_open(const char* filename);
|
||||
void *rt_module_malloc(rt_size_t size);
|
||||
void *rt_module_realloc(void *ptr, rt_size_t size);
|
||||
void rt_module_free(rt_module_t module, void *addr);
|
||||
|
||||
+6
-4
@@ -129,13 +129,15 @@ void rt_thread_idle_excute(void)
|
||||
if((module->module_thread == RT_NULL) &&
|
||||
rt_list_isempty(&module->module_object[RT_Object_Class_Thread].object_list) )
|
||||
{
|
||||
/* unload module */
|
||||
rt_module_unload(module);
|
||||
module->nref--;
|
||||
}
|
||||
}
|
||||
#endif //RT_USING_MODULE
|
||||
|
||||
/* unload module */
|
||||
if(module->nref == 0) rt_module_unload(module);
|
||||
#endif
|
||||
}
|
||||
#endif //RT_USING_HEAP
|
||||
#endif
|
||||
}
|
||||
|
||||
static void rt_thread_idle_entry(void* parameter)
|
||||
|
||||
+78
-62
File diff suppressed because it is too large
Load Diff
@@ -97,6 +97,7 @@ typedef struct {
|
||||
#define ELF_STRTAB ".strtab" /* string table */
|
||||
#define ELF_SYMTAB ".symtab" /* symbol table */
|
||||
#define ELF_TEXT ".text" /* code */
|
||||
#define ELF_RTMSYMTAB "RTMSymTab"
|
||||
|
||||
/* Symbol Table Entry */
|
||||
typedef struct elf32_sym {
|
||||
|
||||
+2
-2
@@ -283,9 +283,9 @@ rt_object_t rt_object_allocate(enum rt_object_class_type type, const char* name)
|
||||
#ifdef RT_USING_MODULE
|
||||
if(rt_module_self() != RT_NULL)
|
||||
{
|
||||
object->module_id = (void*)rt_module_self();
|
||||
object->flag |= RT_OBJECT_FLAG_MODULE;
|
||||
}
|
||||
}
|
||||
object->module_id = (void*)rt_module_self();
|
||||
#endif
|
||||
|
||||
/* copy name */
|
||||
|
||||
Reference in New Issue
Block a user