delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/08/18/06:47:53

X-Spam-Check-By: sourceware.org
Message-ID: <46C6CE48.10004@x-ray.at>
Date: Sat, 18 Aug 2007 12:47:36 +0200
From: Reini Urban <rurban AT x-ray DOT at>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-AT; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4
MIME-Version: 1.0
To: Cygwin List <cygwin AT cygwin DOT com>
Subject: python module patch
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--------------070009010302080007060207
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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/

--------------070009010302080007060207
Content-Type: text/plain;
 name="PyAPI_DATA-cyg.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="PyAPI_DATA-cyg.patch"

difforig /usr/include/python2.5

2007-08-18  Reini Urban <rurban AT x-ray DOT 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 */


--------------070009010302080007060207
Content-Type: text/plain; charset=us-ascii

--
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/
--------------070009010302080007060207--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019