[New-bugs-announce] [issue42321] Limitations of building a static python library on Windows (MSVC)

Maarten report at bugs.python.org
Wed Nov 11 06:09:04 EST 2020


New submission from Maarten <madebr at gmail.com>:

`PCbuild/readme.txt` contains a little paragraph about how to build a static python library.
The resulting static `python.lib` library contains all python C API functions.

Windows DLL's don't allow missing symbols, so C extensions modules must link with a library containing the python C API symbols.
When a C extension links to the static python library, it will contain a copy of all python symbols.
This means that python C symbols are used twice: once by a static python.exe executable, and once for each C extension (_extension.pyw).

Is there a way to use C extensions with a static Windows python.exe wuch that the python symbols are used only once?
Does a statically built Windows python.exe support C extension modules at all?

Thanks

I'm currently working on a conan build recipe for cpython at https://github.com/conan-io/conan-center-index/pull/1510
Fow now, I'm disabling extensions on a static MSVC build.

----------
components: Windows
messages: 380747
nosy: maarten, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Limitations of building a static python library on Windows (MSVC)
versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42321>
_______________________________________


More information about the New-bugs-announce mailing list