A. Appropriate C compilers

It is generally the simplest course to build Python extensions with the same toolchain as used to build the Python that will be importing them.

On Windows, with the PythonLabs builds, this means Microsoft Visual C++ version 6 for Python 2.3 or earlier (Python X.Y was built with an earlier version, but this document doesn't describe writing extensions for Python X.Y anyway - most of the examples won't even compile). Python 2.4 is built with Microsoft Visual Studio .NET (a.k.a. Microsoft Visual C++ 7.1 - it's not a build for the .NET runtime).

Python is also part of the Cygwin suite of tools, and you can use Cygwin's version of GCC to build extensions for Cygwin's Python. This is probably the simplest course if you have Windows but not Visual Studio.

At times, it has been possible to use the mingw version of GCC to build extensions for the PythonLabs builds of Python, but I need someone else to tell this story. XXX get that someone!

On Mac OS X, you need the Developer Tools installed. These come with boxed versions of OS X, can be ordered on CD from the Apple Developer Connection (http://developer.apple.com) for shipping and handling costs or downloaded for free from the same site. It's probably a good idea to have the latest version applicable to your version of Mac OS X.

On Linux or one of the BSD variants, you probably already have Python and GCC installed. If not, you'll need to consult your distribution's documentation to see how to get it. Something to be aware of is that some distributions require you to install a ``python-dev'' or ``python-devel'' package before extensions can be built.

On a proprietary Unix Python will probably not be installed, so a good first step would be to build it from source, and make sure you use the same toolchain to build extensions. If you have trouble building Python, you probably will have trouble building extensions, and vice versa.

If you've download binaries from e.g. http://www.sunfreeware.com you should find out which toolchain has been used to build the binary and use that.

XXX is this accurate? do you really need to use the same toolchain for Python and its extensions?

THIS DOCUMENT IS A DRAFT! Comments to mwh@python.net please.