I am asking this question because I need to build a specific module (aspell_python, http://wm.ite.pl/proj/aspell-python/) to work with my 64-bit Python 2.6 which runs on a Windows 7 (64-bit of course) machine. I also always wanted to know how to speed up certain functions with C code so I'd like to make my own external C modules for Python in the future.
Can anyone please tell me the steps required to successfully build a 64-bit Python extension in C? I know Python, I know C but I don't know about Visual Studio or Windows specific developer matters. I tried to follow the official guide on the Python web site (http://docs.python.org/extending/windows.html#building-on-windows) using Visual Studio 2008 (which is the only commercial product available here) but even the most basic example would fail to build.
I've successfully compiled C extensions for Python on 64-bit Windows before by running the following commands from the "Visual Studio 2008 x64 Win64 Command Prompt" in the top level directory of the source distribution of the extension:
I'd use Shed Skin: Just download, unzip, run the init bat, and compile your Python code.
If that doesn't work, and you can get Microsoft's C compiler environment working, try Cython. This tutorial compares a normal Python extension with its generated C version. Updated excerpts:
c_prime.pyx:
setup.py:
compile:
python setup.py build_ext --inplace --compiler=msvc
test_prime.py: