[ctypes-commit] ctypes/source ctypes_dlfcn.h,NONE,1.1.2.1 _ctypes.c,1.226.2.51,1.226.2.52 callproc.c
Brought to you by:
theller
From: Bob I. <et...@us...> - 2006-02-16 00:17:34
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13419/source Modified Files: Tag: branch_1_0 _ctypes.c callproc.c malloc_closure.c Added Files: Tag: branch_1_0 ctypes_dlfcn.h Log Message: ctypes_dlfcn and enhanced Mac OS X dlfcn compatibility Index: malloc_closure.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/malloc_closure.c,v retrieving revision 1.10.6.1 retrieving revision 1.10.6.2 diff -C2 -d -r1.10.6.1 -r1.10.6.2 *** malloc_closure.c 17 Aug 2005 15:54:24 -0000 1.10.6.1 --- malloc_closure.c 16 Feb 2006 00:17:25 -0000 1.10.6.2 *************** *** 1,3 **** - #include <Python.h> #include <ffi.h> #ifdef MS_WIN32 --- 1,2 ---- *************** *** 10,13 **** --- 9,13 ---- # endif #endif + #include <Python.h> #include "ctypes.h" Index: callproc.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/callproc.c,v retrieving revision 1.127.2.26 retrieving revision 1.127.2.27 diff -C2 -d -r1.127.2.26 -r1.127.2.27 *** callproc.c 10 Feb 2006 18:35:32 -0000 1.127.2.26 --- callproc.c 16 Feb 2006 00:17:25 -0000 1.127.2.27 *************** *** 61,65 **** #include <windows.h> #else ! #include <dlfcn.h> #endif --- 61,65 ---- #include <windows.h> #else ! #include "ctypes_dlfcn.h" #endif *************** *** 1156,1163 **** return NULL; mode |= RTLD_NOW; ! handle = dlopen(name, mode); if (!handle) { PyErr_SetString(PyExc_OSError, ! dlerror()); return NULL; } --- 1156,1163 ---- return NULL; mode |= RTLD_NOW; ! handle = ctypes_dlopen(name, mode); if (!handle) { PyErr_SetString(PyExc_OSError, ! ctypes_dlerror()); return NULL; } *************** *** 1173,1177 **** if (dlclose(handle)) { PyErr_SetString(PyExc_OSError, ! dlerror()); return NULL; } --- 1173,1177 ---- if (dlclose(handle)) { PyErr_SetString(PyExc_OSError, ! ctypes_dlerror()); return NULL; } *************** *** 1188,1195 **** if (!PyArg_ParseTuple(args, "is:dlsym", &handle, &name)) return NULL; ! ptr = dlsym(handle, name); if (!ptr) { PyErr_SetString(PyExc_OSError, ! dlerror()); return NULL; } --- 1188,1195 ---- if (!PyArg_ParseTuple(args, "is:dlsym", &handle, &name)) return NULL; ! ptr = ctypes_dlsym(handle, name); if (!ptr) { PyErr_SetString(PyExc_OSError, ! ctypes_dlerror()); return NULL; } --- NEW FILE: ctypes_dlfcn.h --- /******************************************************************/ #ifndef _CTYPES_DLFCN_H_ #define _CTYPES_DLFCN_H_ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef MS_WIN32 #include <dlfcn.h> #ifndef CTYPES_DARWIN_DLFCN #define ctypes_dlsym dlsym #define ctypes_dlerror dlerror #define ctypes_dlopen dlopen #define ctypes_dlclose dlclose #define ctypes_dladdr dladdr #endif /* !CTYPES_DARWIN_DLFCN */ #endif /* !MS_WIN32 */ #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _CTYPES_DLFCN_H_ */ Index: _ctypes.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/_ctypes.c,v retrieving revision 1.226.2.51 retrieving revision 1.226.2.52 diff -C2 -d -r1.226.2.51 -r1.226.2.52 *** _ctypes.c 14 Feb 2006 19:02:39 -0000 1.226.2.51 --- _ctypes.c 16 Feb 2006 00:17:25 -0000 1.226.2.52 *************** *** 113,117 **** # endif #else ! #include <dlfcn.h> #endif #include "ctypes.h" --- 113,117 ---- # endif #else ! #include "ctypes_dlfcn.h" #endif #include "ctypes.h" *************** *** 258,262 **** } #else ! address = (void *)dlsym(handle, name); if (!address) { PyErr_Format(PyExc_ValueError, --- 258,262 ---- } #else ! address = (void *)ctypes_dlsym(handle, name); if (!address) { PyErr_Format(PyExc_ValueError, *************** *** 266,270 **** name, #endif ! dlerror()); return NULL; } --- 266,270 ---- name, #endif ! ctypes_dlerror()); return NULL; } *************** *** 2531,2535 **** } #else ! address = (PPROC)dlsym(handle, name); if (!address) { PyErr_Format(PyExc_AttributeError, --- 2531,2535 ---- } #else ! address = (PPROC)ctypes_dlsym(handle, name); if (!address) { PyErr_Format(PyExc_AttributeError, *************** *** 2539,2543 **** name, #endif ! dlerror()); return NULL; } --- 2539,2543 ---- name, #endif ! ctypes_dlerror()); return NULL; } |