Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
e6723d4d
Commit
e6723d4d
authored
Mar 25, 2020
by
Yuan
Committed by
GitHub
Mar 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add MinGW doc for Python 3.8+ (GH-3454)
parent
8b92bcba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
docs/src/tutorial/appendix.rst
docs/src/tutorial/appendix.rst
+61
-0
No files found.
docs/src/tutorial/appendix.rst
View file @
e6723d4d
...
...
@@ -28,4 +28,65 @@ procedure. Any contributions towards making the Windows install
process smoother is welcomed; it is an unfortunate fact that none of
the regular Cython developers have convenient access to Windows.
Python 3.8+
-----------
Since Python 3.8, the search paths of DLL dependencies has been reset.
(`changelog <https://docs.python.org/3/whatsnew/3.8.html#changes-in-the-python-api>`_)
Only the system paths, the directory containing the DLL or PYD file
are searched for load-time dependencies.
Instead, a new function `os.add_dll_directory() <https://docs.python.org/3.8/library/os.html#os.add_dll_directory>`_
was added to supply additional search paths. But such a runtime update is not applicable in all situations.
Unlike MSVC, MinGW has its owned standard libraries such as ``libstdc++-6.dll``,
which are not placed in the system path (such as ``C:\Windows\System32``).
For a C++ example, you can check the dependencies by MSVC tool ``dumpbin``::
> dumpbin /dependents my_gnu_extension.cp38-win_amd64.pyd
...
Dump of file my_gnu_extension.cp38-win_amd64.pyd
File Type: DLL
Image has the following dependencies:
python38.dll
KERNEL32.dll
msvcrt.dll
libgcc_s_seh-1.dll
libstdc++-6.dll
...
These standard libraries can be embedded via static linking, by adding the following options to the linker::
-static-libgcc -static-libstdc++ -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive
In ``setup.py``, a cross platform config can be added through
extending ``build_ext`` class::
from setuptools import setup
from setuptools.command.build_ext import build_ext
link_args = ['-static-libgcc',
'-static-libstdc++',
'-Wl,-Bstatic,--whole-archive',
'-lwinpthread',
'-Wl,--no-whole-archive']
... # Add extensions
class Build(build_ext):
def build_extensions(self):
if self.compiler.compiler_type == 'mingw32':
for e in self.extensions:
e.extra_link_args = link_args
super(Build, self).build_extensions()
setup(
...
cmdclass={'build_ext': Build},
...
)
.. [WinInst] https://github.com/cython/cython/wiki/CythonExtensionsOnWindows
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment