This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

python module patch


On order to compile some python modules I needed the attached patch.
Can the maintainer confirm this? Or Yaakov?

extern __declspec(dllexport) cannot be used as constant during compile-time.
=> "initializer element is not constant"
cygwin auto-import feature get's that right at link-time.

This is needed for the constant (compile-time) resolution of PyObject_HEAD_INIT(&PyType_Type) in a typical PyTypeObject struct.

As workaround overriding this in object.h helped also:

diff -ub /usr/include/python2.5/object.h.orig /usr/include/python2.5/object.h
--- /usr/include/python2.5/object.h.orig 2007-06-20 03:57:08.001000000 +0000
+++ /usr/include/python2.5/object.h 2007-08-18 10:37:03.937500000 +0000
@@ -372,7 +372,7 @@
#define PyObject_TypeCheck(ob, tp) \
((ob)->ob_type == (tp) || PyType_IsSubtype((ob)->ob_type, (tp)))


-PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */
+extern PyTypeObject PyType_Type; /* built-in 'type' */
 PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */
 PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */


-- Reini Urban http://phpwiki.org/ http://murbreak.at/ http://helsinki.at/ http://spacemovie.mur.at/
difforig /usr/include/python2.5

2007-08-18  Reini Urban <rurban@x-ray.at>

diff -ub  /usr/include/python2.5/pyport.h.orig
--- /usr/include/python2.5/pyport.h.orig	2007-06-20 03:57:09.001000000 +0000
+++ /usr/include/python2.5/pyport.h	2007-08-18 10:38:12.140625000 +0000
@@ -609,12 +609,13 @@
 #	if defined(HAVE_DECLSPEC_DLL)
 #		ifdef Py_BUILD_CORE
 #			define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
-#			define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE
 			/* module init functions inside the core need no external linkage */
 			/* except for Cygwin to handle embedding (FIXME: BeOS too?) */
 #			if defined(__CYGWIN__)
+#				define PyAPI_DATA(RTYPE) extern RTYPE
 #				define PyMODINIT_FUNC __declspec(dllexport) void
 #			else /* __CYGWIN__ */
+#				define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE
 #				define PyMODINIT_FUNC void
 #			endif /* __CYGWIN__ */
 #		else /* Py_BUILD_CORE */

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]