lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On 2018-02-02 09:18 PM, Sean Conner wrote:
It was thus said that the Great Soni They/Them L. once stated:
I like packaging relative modules because they can be installed under
any project. Wanna use my thing but don't want name conflicts? plop it
into a new namespace, because my thing is designed for it! Well, as long
as it's not a C module...

But then, I guess one can technically use package.loadlib. But uh...

http://www.lua.org/manual/5.3/manual.html#pdf-package.loadlib

The docs imply Lua uses RTLD_GLOBAL for everything. This makes me sad. :(
   Read the source.

static void *lsys_load (lua_State *L, const char *path, int seeglb) {
   void *lib = dlopen(path, RTLD_NOW | (seeglb ? RTLD_GLOBAL : RTLD_LOCAL));
   if (lib == NULL) lua_pushstring(L, dlerror());
   return lib;
}

     reg = lsys_load(L, path, *sym == '*');  /* global symbols if 'sym'=='*' */

   -spc



Ah nice. Guess I should load my C modules myself.

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.