lua-users home
lua-l archive

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

Hi All,
  I have problem with the way lua open libraries using dlopen:

static void *ll_load (lua_State *L, const char *path) {
 void *lib = dlopen(path, RTLD_NOW);
 if (lib == NULL) lua_pushstring(L, dlerror());
 return lib;

I need lua to use the flag RTLD_GLOBAL and I want my library to be
loaded in a standard lua interpreter. I don't know if anyone else had
problems with this, but I'm proposing change dlopen using the same
approximation as python:

(this is in
setdlopenflags( n)   Set the flags used by the interpreter for
dlopen()   calls, such as when the interpreter loads extension
modules.  Among   other things, this will enable a lazy resolving of
symbols when   importing a module, if called as sys.setdlopenflags(0).
To   share symbols across extension modules, call as
sys.setdlopenflags(dl.RTLD_NOW | dl.RTLD_GLOBAL)

In this way dlopen could be used as now, and with very little change
user will be able to manage how libraries are loaded.

By the way... I will need to show an error ("this can not be uses in a
standard lua interpreter, please change line 69 of loadlib.c  with

Best regards,
   Jose L.

PD: Related threads :

 Jose L. Hidalgo Valiño (PpluX)
 ---- ----