Mercurial > cpython-lru_cache-weakref
diff Python/dynload_shlib.c @ 18689:064de84385ca legacy-trunk
Patch #412229: Add functions sys.getdlopenflags and sys.setdlopenflags.
Add dlopenflags to PyInterpreterState, and use it in dlopen calls.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Wed, 18 Jul 2001 16:17:16 +0000 |
| parents | 3b9b8f2ddfe7 |
| children | 4d2cb6eaa411 |
line wrap: on
line diff
--- a/Python/dynload_shlib.c Wed Jul 18 15:30:25 2001 +0000 +++ b/Python/dynload_shlib.c Wed Jul 18 16:17:16 2001 +0000 @@ -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 @@ void *handle; char funcname[258]; char pathbuf[260]; + int dlopenflags=0; if (strchr(pathname, '/') == NULL) { /* Prefix bare filename with "./" */ @@ -80,16 +77,13 @@ } } -#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;
