diff options
author | midipix <writeonce@midipix.org> | 2025-06-21 09:21:20 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2025-06-21 09:21:20 +0000 |
commit | abbfe7adc44e7259841788ec8f5b1a69132cbcec (patch) | |
tree | 99ec68df85b4307a91d7544bbf276d88cd33ad4f /src/core | |
parent | 8c3ccc38e7c0bde90d2b1009539267a4935b16fc (diff) | |
download | sltdl-abbfe7adc44e7259841788ec8f5b1a69132cbcec.tar.bz2 sltdl-abbfe7adc44e7259841788ec8f5b1a69132cbcec.tar.xz |
lt_dlsym(): support symbol tables in addition to dlopen'ed modules.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lt_path.c | 11 |
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) |