summaryrefslogtreecommitdiff
path: root/Python/importdl.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-12-02 20:43:18 +0000
committerGuido van Rossum <guido@python.org>1997-12-02 20:43:18 +0000
commit08052c7bb6ef674782ccef7dc11d71cbe398b5a5 (patch)
treed5b69f92ee40af561f320e76f36a45a79e650ce2 /Python/importdl.c
parentc425d2f87bd39e4e8f4cc0260862d51eb72378e7 (diff)
downloadcpython-git-08052c7bb6ef674782ccef7dc11d71cbe398b5a5.tar.gz
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...)
Diffstat (limited to 'Python/importdl.c')
-rw-r--r--Python/importdl.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Python/importdl.c b/Python/importdl.c
index b11e1e3226..477b104845 100644
--- a/Python/importdl.c
+++ b/Python/importdl.c
@@ -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());