Re: Python 2.6 and wrapping C libraries on Windows
- From: Christian Heimes <lists@xxxxxxxxxx>
- Date: Wed, 30 Apr 2008 21:19:38 +0200
L. Lindstrom schrieb:
I have read that Python extension modules must link to the same C
run-time as the Python interpreter. This I can appreciate. But does this
requirement extend to the C libraries an extension module wraps. The
case in point is Pygame and SDL. The Pygame extension modules are built
with distutils, so for Python 2.6 using Visual Studio 2008 should ensure
the .pyd files link to msvcr90.dll. But SDL is built using Msys/MinGW
and the configure/make tool chain. This fails when linking to
msvcr90.dll since the small test programs configure builds lack manifest
files. They fail to load msvcr90.dll, raising an R6034 error instead. So
besides heap management and FILE pointers, is there any reason SDL, or
any C dependency, needs to link to the same C run-time as Python? If I
ensure SDL frees memory it allocates and does not directly access a file
opened by Python can I just use another C run-time such as msvcrt?
Your analysis of the problem and the implication of mixing CRTs is
correct. However ...
It should be trivial to modify the build systemof SDL so that the
manifest is integrated into the DLLs. Everything else is a hack. It
*should* work and in reality it *does* work for most cases. But someday
you'll hit a solid wall and get strange and hard to debug segfaults.
It's in your own interest to get it right in the first place. And you'd
serve the Python community greatly by providing a nice tutorial how to
modify 3rd party builds. *hint* :)
If you need any help feel free to contact me. The new build system is
mostly my work with help from Martin, Amaury and other core developers.
Christian
.
- References:
- Python 2.6 and wrapping C libraries on Windows
- From: L. Lindstrom
- Python 2.6 and wrapping C libraries on Windows
- Prev by Date: Re: calling variable function name ?
- Next by Date: Re: computing with characters
- Previous by thread: Python 2.6 and wrapping C libraries on Windows
- Next by thread: Re: Python -v import behavior
- Index(es):
Relevant Pages
|