summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2025-06-21 09:21:20 +0000
committermidipix <writeonce@midipix.org>2025-06-21 09:21:20 +0000
commitabbfe7adc44e7259841788ec8f5b1a69132cbcec (patch)
tree99ec68df85b4307a91d7544bbf276d88cd33ad4f
parent8c3ccc38e7c0bde90d2b1009539267a4935b16fc (diff)
downloadsltdl-abbfe7adc44e7259841788ec8f5b1a69132cbcec.tar.bz2
sltdl-abbfe7adc44e7259841788ec8f5b1a69132cbcec.tar.xz
lt_dlsym(): support symbol tables in addition to dlopen'ed modules.
-rw-r--r--src/core/lt_path.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/lt_path.c b/src/core/lt_path.c
index 6103119..3fb0385 100644
--- a/src/core/lt_path.c
+++ b/src/core/lt_path.c
@@ -479,7 +479,16 @@ struct lt_modctx * lt_dlopenadvise(const char * module, struct lt_modctl * modct
void * lt_dlsym(struct lt_modctx * modctx, const char * symname)
{
- return dlsym(modctx->maddr,symname);
+ const struct lt_symdef * sym;
+
+ if (modctx->maddr)
+ return dlsym(modctx->maddr,symname);
+
+ for (sym=modctx->symtbl; sym->name; sym++)
+ if (!strcmp(sym->name,symname))
+ return sym->address;
+
+ return 0;
}
int lt_dlclose(struct lt_modctx * modctx)