diff options
author | Thomas Heller <theller@ctypes.org> | 2006-04-06 15:23:16 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2006-04-06 15:23:16 (GMT) |
commit | fff61ea025e9ef31a2a467e685cbda3277d5237f (patch) | |
tree | 1bcaa7f235b0bb72f166ba0c906528ed23fe6d1c /Modules/_ctypes | |
parent | a4d651fbc8055a59a20e52ddc745a511a1c0b431 (diff) | |
download | cpython-fff61ea025e9ef31a2a467e685cbda3277d5237f.zip cpython-fff61ea025e9ef31a2a467e685cbda3277d5237f.tar.gz cpython-fff61ea025e9ef31a2a467e685cbda3277d5237f.tar.bz2 |
Expose RTLD_LOCAL and RTLD_GLOBAL always from the _ctypes extension module.
If RTLD_LOCAL is not #defined in any header file (Windows), set it to 0.
If RTLD_GLOBAL is not #defined, set it equal to RTLD_LOCAL.
This should fix ctypes on cygwin.
Diffstat (limited to 'Modules/_ctypes')
-rw-r--r-- | Modules/_ctypes/_ctypes.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 0743ec9..b9cac39 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -4575,10 +4575,20 @@ init_ctypes(void) PyModule_AddObject(m, "_wstring_at_addr", PyLong_FromVoidPtr(wstring_at)); #endif -#ifdef RTLD_LOCAL +/* If RTLD_LOCAL is not defined (Windows!), set it to zero. */ +#ifndef RTLD_LOCAL +#define RTLD_LOCAL 0 +#endif + +/* If RTLD_GLOBAL is not defined (cygwin), set it to the same value as + RTLD_LOCAL. +*/ +#ifndef RTLD_GLOBAL +#define RTLD_GLOBAL RTLD_LOCAL +#endif + PyModule_AddObject(m, "RTLD_LOCAL", PyInt_FromLong(RTLD_LOCAL)); PyModule_AddObject(m, "RTLD_GLOBAL", PyInt_FromLong(RTLD_GLOBAL)); -#endif PyExc_ArgError = PyErr_NewException("ctypes.ArgumentError", NULL, NULL); if (PyExc_ArgError) { |