更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
Dynamic loading
Dynamic loading 的协作图:

结构体

struct  tagDynloadParam
 

类型定义

typedef struct tagDynloadParam DYNLOAD_PARAM_S
 

枚举

enum  LOAD_STRATEGY { ZIP , NOZIP }
 

函数

BOOL LOS_DynMemPoolSet (VOID *memPool)
 Set the memory pool address used by dynload 更多...
 
VOID * LOS_SoLoad (CHAR *elfFileName)
 Load a shared object file. 更多...
 
VOID * LOS_ObjLoad (CHAR *elfFileName)
 Load a object file. 更多...
 
INT32 LOS_ModuleUnload (VOID *handle)
 Unload a module. 更多...
 
VOID LOS_LdDestroy (VOID)
 Destroy a dynamic loader. 更多...
 
VOID * LOS_FindSymByName (VOID *handle, CHAR *name)
 Search for a symbol address. 更多...
 
INT32 LOS_PathAdd (CHAR *path)
 Add a default path. 更多...
 
VOID LOS_DynParamReg (DYNLOAD_PARAM_S *dynloadParam)
 Register the dynamic parameters. 更多...
 

详细描述

类型定义说明

◆ DYNLOAD_PARAM_S

Define the structure of the parameters used for dynamic.

Information of specified parameters passed in during dynamic load.

枚举类型说明

◆ LOAD_STRATEGY

Define an enum type indicates load strategy.

Type of load strategy of dynamic load, ZIP means using zipped shared object, NOZIP means using normal shared object.

枚举值
ZIP 
NOZIP 

在文件 los_ld_elflib.h204 行定义.

204 {
205 ZIP,
206 NOZIP
207};
@ NOZIP
@ ZIP

函数说明

◆ LOS_DynMemPoolSet()

BOOL LOS_DynMemPoolSet ( VOID *  memPool)

Set the memory pool address used by dynload

Description:
This API is used to set the memory pool address used by dynload.
注意
  • The parameter passed to this API should be a legal memory pool address by managed with LiteOS's memory algorithm, and whose value is outside of the LiteOS system memory
参数
memPool[IN] the memory pool address.
返回值
TRUESet successful.
FLASESet failed.
Dependency:
参见
LOS_ModuleUnload

◆ LOS_DynParamReg()

VOID LOS_DynParamReg ( DYNLOAD_PARAM_S dynloadParam)

Register the dynamic parameters.

Description:
This API is used to register the dynamic load parameters.
注意
参数
dynloadParam[IN] dynamic load parameters to be registered.
Dependency:
参见
LOS_FindSymByName | LOS_LdDestroy

◆ LOS_FindSymByName()

VOID * LOS_FindSymByName ( VOID *  handle,
CHAR name 
)

Search for a symbol address.

Description:
This API is used to search for the address of a symbol according to a particular module handle and symbol name.
注意
  • If the value of handle is NULL, Huawei LiteOS searches for symbols (including system symbols) in the global symbol table. If handle is set to a valid module handle, Huawei LiteOS searches for symbols in the module that comes with the module handle.
参数
handle[IN] Module handle.
name[IN] Name of the symbol to be searched for.
返回值
NULLThe symbol address is not found.
VOID*Symbol address.
Dependency:
参见
LOS_LdDestroy

◆ LOS_LdDestroy()

VOID LOS_LdDestroy ( VOID  )

Destroy a dynamic loader.

Description:
This API is used to destroy a dynamic linker.
注意
  • When dynamic loading is no longer needed, call this API to destroy the dynamic linker.
参数
None.
返回值
None.
Dependency:
参见
LOS_FindSymByName

◆ LOS_ModuleUnload()

INT32 LOS_ModuleUnload ( VOID *  handle)

Unload a module.

Description:
This API is used to unload a module with a particular module handle.
注意
  • None.
参数
handle[IN] Module handle.
返回值
#LOS_NOKThe module fails to be unloaded.
#LOS_OKThe module is successfully unloaded.
Dependency:
参见
LOS_ObjLoad

◆ LOS_ObjLoad()

VOID * LOS_ObjLoad ( CHAR elfFileName)

Load a object file.

Description:
This API is used to load a object file under a particular module file path.
注意
  • The parameter passed to this API should be a legal path of an object file.
参数
elfFileName[IN] Object file path.
返回值
NULLThe object file fails to be loaded.
VOID*The object file is successfully loaded.
Dependency:
参见
LOS_ModuleUnload

◆ LOS_PathAdd()

INT32 LOS_PathAdd ( CHAR path)

Add a default path.

Description:
This API is used to add a path to default paths.
注意
参数
path[IN] Path to be added to default paths.
返回值
#LOS_NOKThe path is added unsuccessfully.
#LOS_OKThe path is added successfully.
Dependency:
参见
LOS_FindSymByName | LOS_LdDestroy

◆ LOS_SoLoad()

VOID * LOS_SoLoad ( CHAR elfFileName)

Load a shared object file.

Description:
This API is used to load a shared object file under a particular module file path.
注意
  • The parameter passed to this API should be a legal path of a shared object file.
参数
elfFileName[IN] Shared object file path.
返回值
NULLThe shared object file fails to be loaded.
VOID*The shared object file is successfully loaded.
Dependency:
参见
LOS_ModuleUnload