lua-5.1: make Lua C modules load dynamic libraries with global symbols

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

lua-5.1: make Lua C modules load dynamic libraries with global symbols

David Coppa-4

Hi,

I'd like to revamp this useful patch from tedu@ that was never
committed.

Lua-5.2 already does a similar thing.

OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/lua/5.1/Makefile,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile
--- Makefile 10 Jul 2012 15:04:52 -0000 1.1
+++ Makefile 8 Nov 2012 09:04:51 -0000
@@ -2,7 +2,7 @@
 
 VERSION= 5.1.5
 PKGSPEC= lua->=5.1,<5.2
-REVISION= 0
+REVISION= 1
 
 SHARED_LIBS= lua5.1 ${VERSION:R}
 
Index: patches/patch-src_loadlib_c
===================================================================
RCS file: patches/patch-src_loadlib_c
diff -N patches/patch-src_loadlib_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_loadlib_c 8 Nov 2012 09:04:51 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+Make Lua C modules load dynamic libraries with global symbols
+
+--- src/loadlib.c.orig Tue Nov  6 11:24:02 2012
++++ src/loadlib.c Tue Nov  6 11:24:41 2012
+@@ -66,7 +66,7 @@ static void ll_unloadlib (void *lib) {
+
+
+ static void *ll_load (lua_State *L, const char *path) {
+-  void *lib = dlopen(path, RTLD_NOW);
++  void *lib = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
+   if (lib == NULL) lua_pushstring(L, dlerror());
+   return lib;
+ }