summaryrefslogtreecommitdiffstats
path: root/Python/dynload_shlib.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2001-07-18 16:17:16 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2001-07-18 16:17:16 (GMT)
commitf0473d511b7f883bfff3048f55e3a6adc7a43cb9 (patch)
tree8239a8d19fe2851555ff96b250cad6e24760717d /Python/dynload_shlib.c
parent984158d25bd76fa33d4245e98f53c876f428d5f4 (diff)
downloadcpython-f0473d511b7f883bfff3048f55e3a6adc7a43cb9.zip
cpython-f0473d511b7f883bfff3048f55e3a6adc7a43cb9.tar.gz
cpython-f0473d511b7f883bfff3048f55e3a6adc7a43cb9.tar.bz2
Patch #412229: Add functions sys.getdlopenflags and sys.setdlopenflags.
Add dlopenflags to PyInterpreterState, and use it in dlopen calls.
Diffstat (limited to 'Python/dynload_shlib.c')
-rw-r--r--Python/dynload_shlib.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c
index 7c8bfd2..7de3b7d 100644
--- a/Python/dynload_shlib.c
+++ b/Python/dynload_shlib.c
@@ -22,10 +22,6 @@
#define LEAD_UNDERSCORE ""
#endif
-#ifndef RTLD_LAZY
-#define RTLD_LAZY 1
-#endif
-
const struct filedescr _PyImport_DynLoadFiletab[] = {
#ifdef __CYGWIN__
@@ -53,6 +49,7 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
void *handle;
char funcname[258];
char pathbuf[260];
+ int dlopenflags=0;
if (strchr(pathname, '/') == NULL) {
/* Prefix bare filename with "./" */
@@ -80,16 +77,13 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
}
}
-#ifdef RTLD_NOW
- /* RTLD_NOW: resolve externals now
- (i.e. core dump now if some are missing) */
- handle = dlopen(pathname, RTLD_NOW);
-#else
+ dlopenflags = PyThreadState_Get()->interp->dlopenflags;
+
if (Py_VerboseFlag)
- printf("dlopen(\"%s\", %d);\n", pathname,
- RTLD_LAZY);
- handle = dlopen(pathname, RTLD_LAZY);
-#endif /* RTLD_NOW */
+ printf("dlopen(\"%s\", %x);\n", pathname, dlopenflags);
+
+ handle = dlopen(pathname, dlopenflags);
+
if (handle == NULL) {
PyErr_SetString(PyExc_ImportError, dlerror());
return NULL;