]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add the flag RTLD_GLOBAL to the dlopen() options.
authorGuido van Rossum <guido@python.org>
Tue, 2 Dec 1997 20:43:18 +0000 (20:43 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 2 Dec 1997 20:43:18 +0000 (20:43 +0000)
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...)

Python/importdl.c

index b11e1e32269a8ea06cd7360947895e98cbb93b2a..477b1048456f0e7cb14aaa268bcdf6a60f3b57be 100644 (file)
@@ -171,6 +171,9 @@ typedef void (*dl_funcptr)();
 #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 @@ _PyImport_LoadDynamicModule(name, pathname, fp)
 #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());