summaryrefslogtreecommitdiffstats
path: root/Doc/ext
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1999-02-16 21:14:16 (GMT)
committerFred Drake <fdrake@acm.org>1999-02-16 21:14:16 (GMT)
commit3de61bc13f6ebf3dcf24ddb2fbe7b25766fec78b (patch)
treee3665cf1078b53d8bd53596210cc2a54d50e6bd1 /Doc/ext
parentf6838c0f5ebfa1750c1a92c6bb7cc40c030f3a77 (diff)
downloadcpython-3de61bc13f6ebf3dcf24ddb2fbe7b25766fec78b.zip
cpython-3de61bc13f6ebf3dcf24ddb2fbe7b25766fec78b.tar.gz
cpython-3de61bc13f6ebf3dcf24ddb2fbe7b25766fec78b.tar.bz2
Integrated notes on building extension modules on Windows, by Neil
Schemenauer <neil_schemenauer@transcanada.com>. Thanks, Neil!
Diffstat (limited to 'Doc/ext')
-rw-r--r--Doc/ext/ext.tex51
1 files changed, 50 insertions, 1 deletions
diff --git a/Doc/ext/ext.tex b/Doc/ext/ext.tex
index 1ae0421..646d951 100644
--- a/Doc/ext/ext.tex
+++ b/Doc/ext/ext.tex
@@ -1511,7 +1511,7 @@ Python source code distribution).
\chapter{Building C and \Cpp{} Extensions on \UNIX{}
- \label{building-extensions}}
+ \label{building-on-unix}}
\sectionauthor{Fim Fulton}{jim@Digicool.com}
@@ -1680,6 +1680,55 @@ Do not distribute a make file. People building your modules
should use \file{Makefile.pre.in} to build their own make file.
+\chapter{Building C and \Cpp{} Extensions on Windows
+ \label{building-on-unix}}
+
+\sectionauthor{Neil Schemenauer}{neil_schemenauer@transcanada.com}
+
+
+This chapter briefly explains how to create a Windows extension module
+for Python using Microsoft Visual \Cpp{}.
+
+Grab the binary installer from \url{http://www.python.org/} and
+install Python. The binary installer has all of the required header
+files except for \file{config.h}.
+
+Get the source distribution and extract it into a convenient location.
+Copy the \file{config.h} from the \file{PC/} directory into the
+\file{include/} directory created by the installer.
+
+Create a \file{Setup} file for your extension module, as described in
+Chapter \ref{building-on-unix}.
+
+Get David Ascher's \file{compile.py} script from
+\url{http://starship.skyport.net/~da/compile/}. Run the script to
+create Microsoft Visual \Cpp{} project files.
+
+Open the DSW file in V\Cpp{} and select \strong{Build}.
+
+If your module creates a new type, you may have trouble with this line:
+
+\begin{verbatim}
+ PyObject_HEAD_INIT(&PyType_Type)
+\end{verbatim}
+
+Change it to:
+
+\begin{verbatim}
+ PyObject_HEAD_INIT(NULL)
+\end{verbatim}
+
+and add the following to the module initialization function:
+
+\begin{verbatim}
+ MyObject_Type.ob_type = &PyType_Type;
+\end{verbatim}
+
+Refer to section 3 of the Python FAQ
+(\url{http://www.python.org/doc/FAQ.html}) for details on why you must
+do this.
+
+
\chapter{Embedding Python in Another Application
\label{embedding}}