public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Masamichi Hosoda <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
Date: Sun, 23 Jan 2022 18:42:37 +0900 (JST)	[thread overview]
Message-ID: <20220123.184237.588444363094903098.trueroad@trueroad.jp> (raw)
In-Reply-To: <20220122.191639.929494193658372882.trueroad@trueroad.jp>

> 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.
```

  reply	other threads:[~2022-01-23  9:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-12 11:47 ggl329
2022-01-12 22:16 ` Marco Atzeri
2022-01-14  2:04   ` airplanemath
2022-01-18 20:55     ` Marco Atzeri
2022-01-22  1:04       ` Masamichi Hosoda
2022-01-22  5:24         ` Marco Atzeri
2022-01-22 10:16           ` Masamichi Hosoda
2022-01-23  9:42             ` Masamichi Hosoda [this message]
2022-02-06 17:35             ` airplanemath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220123.184237.588444363094903098.trueroad@trueroad.jp \
    --to=trueroad@trueroad.jp \
    --cc=cygwin@cygwin.com \
    --cc=marco.atzeri@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).