diff Python/importdl.c @ 6724:2e3acb2140bf legacy-trunk

Add the flag RTLD_GLOBAL to the dlopen() options. This exports symbols defined by the loaded extension to other extensions (loaded later). (I'm not quite sure about this but suppose it can't hurt...)
author Guido van Rossum <guido@python.org>
date Tue, 02 Dec 1997 20:43:18 +0000
parents 5e31d381fa47
children fa09372f7872
line wrap: on
line diff
--- a/Python/importdl.c	Tue Dec 02 20:41:39 1997 +0000
+++ b/Python/importdl.c	Tue Dec 02 20:43:18 1997 +0000
@@ -171,6 +171,9 @@
 #ifndef RTLD_LAZY
 #define RTLD_LAZY 1
 #endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
 #define SHORT_EXT ".so"
 #define LONG_EXT "module.so"
 #endif /* USE_SHLIB */
@@ -362,12 +365,13 @@
 #ifdef RTLD_NOW
 		/* RTLD_NOW: resolve externals now
 		   (i.e. core dump now if some are missing) */
-		void *handle = dlopen(pathname, RTLD_NOW);
+		void *handle = dlopen(pathname, RTLD_NOW | RTLD_GLOBAL);
 #else
 		void *handle;
 		if (Py_VerboseFlag)
-			printf("dlopen(\"%s\", %d);\n", pathname, RTLD_LAZY);
-		handle = dlopen(pathname, RTLD_LAZY);
+			printf("dlopen(\"%s\", %d);\n", pathname,
+			       RTLD_LAZY | RTLD_GLOBAL);
+		handle = dlopen(pathname, RTLD_LAZY | RTLD_GLOBAL);
 #endif /* RTLD_NOW */
 		if (handle == NULL) {
 			PyErr_SetString(PyExc_ImportError, dlerror());