From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from msc13.plala.or.jp (msc13.plala.or.jp [IPv6:2400:7800:0:502e::23]) by sourceware.org (Postfix) with ESMTP id C81453858D3C for ; Sun, 23 Jan 2022 09:42:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C81453858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=trueroad.jp Authentication-Results: sourceware.org; spf=none smtp.mailfrom=trueroad.jp Received: from localhost ([118.16.110.64]) by msc13.plala.or.jp with ESMTP id <20220123094243.TJJZ9444.msc13.plala.or.jp@localhost>; Sun, 23 Jan 2022 18:42:43 +0900 Date: Sun, 23 Jan 2022 18:42:37 +0900 (JST) Message-Id: <20220123.184237.588444363094903098.trueroad@trueroad.jp> To: marco.atzeri@gmail.com Cc: cygwin@cygwin.com, trueroad@trueroad.jp Subject: Re: python-numpy (1.22.0-1) can't be imported From: Masamichi Hosoda In-Reply-To: <20220122.191639.929494193658372882.trueroad@trueroad.jp> References: <20220122.100435.1822912027393751150.trueroad@trueroad.jp> <89f4e748-9e1c-b0de-834b-2511b988f14a@gmail.com> <20220122.191639.929494193658372882.trueroad@trueroad.jp> X-Mailer: Mew version 6.8 on Emacs 27.2 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-VirusScan: Outbound; mvir-ac13; Sun, 23 Jan 2022 18:42:43 +0900 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jan 2022 09:42:49 -0000 > If I understand correctly, I've found the root cause of the issue. > I've sent a pull request to numpy. > https://github.com/numpy/numpy/pull/20874 A question is asked by NumPy if there is documentation on the Cygwin package's Cython behavior. https://github.com/numpy/numpy/pull/20874#issuecomment-1019442058 Does such a document exist? One of the causes of this issue is a patch in Cygwin's python-cython package like the one below. It removes the `__declspec(dllexport)` attribute from the symbols to be exported. On the other hand, if you install Cython by pip without using the Cygwin package, the exported symbols have the `__declspec(dllexport)` attribute because the patch has not been applied. What is the purpose of removing the `__declspec(dllexport)` attribute in this patch? Is this to make the modules using Cython without considering the Cygwin environment, the module does not have the `__declspec(dllexport)` attribute like Linux environment, works correctly? ``` --- origsrc/Cython-0.29.21/Cython/Utility/ModuleSetupCode.c 2020-07-08 23:44:39.000000000 +0200 +++ Cython/Utility/ModuleSetupCode.c 2021-01-30 08:34:37.402649500 +0100 @@ -709,7 +709,11 @@ static CYTHON_INLINE void * PyThread_tss /////////////// PyModInitFuncType.proto /////////////// #ifndef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * +#else +#define __Pyx_PyMODINIT_FUNC PyObject * +#endif #elif PY_MAJOR_VERSION < 3 // Py2: define this to void manually because PyMODINIT_FUNC adds __declspec(dllexport) to it's definition. ```