O'Reilly logo

Python Programming On Win32 by Mark Hammond, Andy Robinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Python and Visual C++

Python is written in C and can be embedded in both C and C++ programs and extended with routines written in C and C++. The standard Python documentation includes a good tutorial on extending and embedding Python, which we won’t repeat, and we certainly won’t try to teach you C.

There are a number of reasons to use Visual C++ during your travels with Python:

  • To build Python from sources. Many companies that ship Python binaries like to know they can build everything from C sources and have control over those sources (for example, checked into their source control system). The same applies to all Python extensions your application may use.

  • To write a Python extensions as a DLL or if you have the sources to an interesting Python extension, but no binary for Windows for your Python version.

  • To make an existing C or C++ library available to Python.

  • To embed Python in a C or C++ application for one of the many good reasons for doing so!

Tip

When you install Python in Windows, the C language header and library files are also optionally installed. These files are enough to build Python extensions on Windows without downloading the full Python sources.

Many of you are familiar with compiling C programs (and Python) on Unix, while others aren’t C programmers at all. Although we attempt to make this chapter understandable for C novices, we certainly don’t attempt to teach either the C++ language or the Microsoft Developers Studio environment.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required