From abbfe7adc44e7259841788ec8f5b1a69132cbcec Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 21 Jun 2025 09:21:20 +0000 Subject: lt_dlsym(): support symbol tables in addition to dlopen'ed modules. --- src/core/lt_path.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') 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) -- cgit v1.2.3