Sunday, January 22, 2006

ctypes on Mac OS X 10.4 with gcc 4.0

python :: programming :: macosx



I had some trouble installing ctypes on a 10.4 server tonight, and found
this
little post

that gave a patch for it. Unfortunately, this was for the file in 2004
and I had to manually edit the current 4000+ line file.

Apparently, this was in CVS in 2004 but hasn't made it into a distro
since...

For the search engines, I will post the error message (where xxx are
your line numbers):


source/_ctypes.c:xxx: error: static declaration of 'Pointer_Type'
follows non-static declaration
source/ctypes.h:xxx: error: previous declaration of 'Pointer_Type' was
here

And here's a copy of my diff against _ctypes.c in ctypes 0.9.6:


--- third-party/ctypes-0.9.6/source/_ctypes.c (revision 53)
+++ third-party/ctypes-0.9.6/source/_ctypes.c (working copy)
@@ -2449,7 +2449,7 @@
"sO|O" - function name, dll object (with an integer handle)
"is|O" - vtable index, method name, creates callable calling COM vtbl
*/
-static PyObject *
+PyObject *
CFuncPtr_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
CFuncPtrObject *self;
@@ -3880,7 +3880,7 @@
(inquiry)Pointer_nonzero, /* nb_nonzero */
};

-static PyTypeObject Pointer_Type = {
+PyTypeObject Pointer_Type = {
PyObject_HEAD_INIT(NULL)
0,
"_ctypes._Pointer",


No comments: