
18 May
2023
18 May
'23
4:21 p.m.
Add RTLD_NODELETE, do not unload shared objects during dlclose(). Therefore, if the object is reloaded later using dlopen(), the object's static variables are not reinitialized. Signed-off-by: Wenkai Lin <linwenkai6@hisilicon.com> --- wd_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wd_util.c b/wd_util.c index 330d53a..5b3aa8d 100644 --- a/wd_util.c +++ b/wd_util.c @@ -2264,7 +2264,7 @@ void *wd_dlopen_drv(const char *cust_lib_dir) if (ret < 0) goto free_node; - node->dlhandle = dlopen(lib_path, RTLD_NOW); + node->dlhandle = dlopen(lib_path, RTLD_NODELETE | RTLD_NOW); if (!node->dlhandle) { free(node); /* there are many other files need to skip */ -- 2.30.0