#
4. Building C and C++ Extensions on Windows

This chapter briefly explains how to create a Windows extension module for Python using Microsoft Visual C++, and follows with more detailed background information on how it works. The explanatory material is useful for both the Windows programmer learning to build Python extensions and the Unix programmer interested in producing software which can be successfully built on both Unix and Windows.

Module authors are encouraged to use the distutils approach for building extension modules, instead of the one described in this section. You will still need the C compiler that was used to build Python; typically Microsoft Visual C++.

Note: This chapter mentions a number of filenames that include an encoded Python version number. These filenames are represented with the version number shown as "`XY`"; in practive, "`X`" will be the major version number and "`Y`" will be the minor version number of the Python release you're working with. For example, if you are using Python 2.2.1, "`XY`" will actually be "`22`".

Subsections

- 4.1 A Cookbook Approach
- 4.2 Differences Between Unix and Windows
- 4.3 Using DLLs in Practice