From 64a26cc67d6782d1ee8812c8c1307a2607144b97 Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 21 Dec 2019 11:52:47 +0000 Subject: lt_dlsym(), lt_dlclose(): initial implementation and integration. --- src/core/lt_path.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src') diff --git a/src/core/lt_path.c b/src/core/lt_path.c index 37fec79..4981b1e 100644 --- a/src/core/lt_path.c +++ b/src/core/lt_path.c @@ -408,3 +408,28 @@ struct lt_modctx * lt_dlopenadvise(const char * module, struct lt_modctl * modct (void)modctl; return lt_dlopenext(module); } + +void * lt_dlsym(struct lt_modctx * modctx, const char * symname) +{ + return dlsym(modctx->maddr,symname); +} + +int lt_dlclose(struct lt_modctx * modctx) +{ + struct lt_modctx * pmod; + + lt_slock(); + + for (pmod=lt_modv_head; pmod ; pmod=pmod->mnext) { + if (pmod == modctx) { + if (pmod->mrefs) { + pmod->mrefs--; + return lt_sunlock(0); + } + + return lt_sunlock(-1); + } + } + + return lt_sunlock(-1); +} -- cgit v1.2.3