From 95d666c01b2cbef481ade4cc4269c9e31d6c6d5d Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 5 Oct 2016 15:52:11 -0400 Subject: [PATCH] Add native modules to the loaded modules list. Otherwise we'd reload/reinit libdoscalls.so (etc) for every module! --- lx_loader.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lx_loader.c b/lx_loader.c index 79fe1a9..7f508a7 100644 --- a/lx_loader.c +++ b/lx_loader.c @@ -1085,6 +1085,16 @@ static LxModule *loadLxModuleByModuleNameInternal(const char *modname, const int *ptr = (((*ptr >= 'A') && (*ptr <= 'Z')) ? (*ptr - ('A' - 'a')) : *ptr); } // for retval = loadNativeModule(fname, modname); + + if (retval != NULL) { + // module is ready to use, put it in the loaded list. + // !!! FIXME: mutex this + if (GLoaderState->loaded_modules) { + retval->next = GLoaderState->loaded_modules; + GLoaderState->loaded_modules->prev = retval; + } // if + GLoaderState->loaded_modules = retval; + } // if } // if return retval; } // loadLxModuleByModuleNameInternal