Update to VC 7.1. Will backport to 2.4.

This commit is contained in:
Martin v. Löwis 2004-12-30 10:44:32 +00:00
parent ee1d24703f
commit 658b50f579

View file

@ -39,10 +39,11 @@ Python extensions written in C or \Cpp.
To build extensions using these instructions, you need to have a copy To build extensions using these instructions, you need to have a copy
of the Python sources of the same version as your installed Python. of the Python sources of the same version as your installed Python.
You will need Microsoft Visual \Cpp{} ``Developer Studio''; project You will need Microsoft Visual \Cpp{} ``Developer Studio''; project
files are supplied for V\Cpp{} version 6, but you can use older files are supplied for V\Cpp{} version 7.1, but you can use older
versions of V\Cpp. The example files described here are distributed versions of V\Cpp. Notice that you should use the same version of
with the Python sources in the \file{PC\textbackslash V\Cpp that was used to build Python itself. The example files
example_nt\textbackslash} directory. described here are distributed with the Python sources in the
\file{PC\textbackslash example_nt\textbackslash} directory.
\begin{enumerate} \begin{enumerate}
\item \item
@ -57,9 +58,9 @@ example_nt\textbackslash} directory.
\item \item
\strong{Open the project}\\ \strong{Open the project}\\
From V\Cpp, use the \menuselection{File \sub Open Workspace} From V\Cpp, use the \menuselection{File \sub Open Solution}
dialog (not \menuselection{File \sub Open}!). Navigate to and dialog (not \menuselection{File \sub Open}!). Navigate to and
select the file \file{example.dsw}, in the \emph{copy} of the select the file \file{example.sln}, in the \emph{copy} of the
\file{example_nt} directory you made above. Click Open. \file{example_nt} directory you made above. Click Open.
\item \item
@ -69,18 +70,17 @@ example_nt\textbackslash} directory.
\begin{enumerate} \begin{enumerate}
\item \item
Select a configuration. This step is optional. Choose Select a configuration. This step is optional. Choose
\menuselection{Build \sub Select Active Configuration} and \menuselection{Build \sub Configuration Manager \sub Active
select either \guilabel{example - Win32 Release} or Solution Configuration} and select either \guilabel{Release}
\guilabel{example - Win32 Debug}. If you skip this step, or\guilabel{Debug}. If you skip this step,
V\Cpp{} will use the Debug configuration by default. V\Cpp{} will use the Debug configuration by default.
\item \item
Build the DLL. Choose \menuselection{Build \sub Build Build the DLL. Choose \menuselection{Build \sub Build
example_d.dll} in Debug mode, or \menuselection{Build \sub Solution}. This creates all intermediate and result files in
Build example.dll} in Release mode. This creates all a subdirectory called either \file{Debug} or \file{Release},
intermediate and result files in a subdirectory called either depending on which configuration you selected in the preceding
\file{Debug} or \file{Release}, depending on which step.
configuration you selected in the preceding step.
\end{enumerate} \end{enumerate}
\item \item
@ -129,7 +129,7 @@ Hello, world
Now your options are: Now your options are:
\begin{enumerate} \begin{enumerate}
\item Copy \file{example.dsw} and \file{example.dsp}, rename \item Copy \file{example.sln} and \file{example.vcproj}, rename
them to \file{spam.*}, and edit them by hand, or them to \file{spam.*}, and edit them by hand, or
\item Create a brand new project; instructions are below. \item Create a brand new project; instructions are below.
\end{enumerate} \end{enumerate}
@ -142,62 +142,62 @@ Hello, world
little file with only two lines. An alternative approach is to little file with only two lines. An alternative approach is to
forget about the \file{.def} file, and add the option forget about the \file{.def} file, and add the option
\programopt{/export:initspam} somewhere to the Link settings, by \programopt{/export:initspam} somewhere to the Link settings, by
manually editing the setting in Project Options dialog). manually editing the setting in Project Properties dialog).
\item \item
\strong{Creating a brand new project}\\ \strong{Creating a brand new project}\\
Use the \menuselection{File \sub New \sub Projects} dialog to Use the \menuselection{File \sub New \sub Project} dialog to
create a new Project Workspace. Select \guilabel{Win32 Dynamic-Link create a new Project Workspace. Select \guilabel{Visual C++
Library}, enter the name (\samp{spam}), and make sure the Projects/Win32/ Win32 Project}, enter the name (\samp{spam}), and
Location is set to the \file{spam} directory you have created make sure the Location is set to parent of the \file{spam}
(which should be a direct subdirectory of the Python build tree, a directory you have created (which should be a direct subdirectory
sibling of \file{Include} and \file{PC}). Select Win32 as the of the Python build tree, a sibling of \file{Include} and
platform (in my version, this is the only choice). Make sure the \file{PC}). Select Win32 as the platform (in my version, this is
Create new workspace radio button is selected. Click OK. the only choice). Make sure the Create new workspace radio button
is selected. Click OK.
Now open the \menuselection{Project \sub Settings} dialog. You You should now create the file \file{spam.def} as instructed in
only need to change a few settings. Make sure All Configurations the previous section. Add the source files to the project, using
is selected from the Settings for: dropdown list. Select the \menuselection{Project \sub Add Existing Item}. Set the pattern to
C/\Cpp{} tab. Choose the Preprocessor category in the popup menu \code{*.*} and select both \file{spam.c} and \file{spam.def} and
at the top. Type the following text in the entry box labeled click OK. (Inserting them one by one is fine too.)
\guilabel{Additional include directories}:
Now open the \menuselection{Project \sub spam properties} dialog.
You only need to change a few settings. Make sure \guilable{All
Configurations} is selected from the \guilable{Settings for:}
dropdown list. Select the C/\Cpp{} tab. Choose the General
category in the popup menu at the top. Type the following text in
the entry box labeled \guilabel{Additional Include Directories}:
\begin{verbatim} \begin{verbatim}
..\Include,..\PC ..\Include,..\PC
\end{verbatim} \end{verbatim}
Then, choose the Input category in the Link tab, and enter Then, choose the General category in the Linker tab, and enter
\begin{verbatim} \begin{verbatim}
..\PCbuild ..\PCbuild
\end{verbatim} \end{verbatim}
in the text box labelled \guilabel{Additional library path}. in the text box labelled \guilabel{Additional library Directories}.
Now you need to add some mode-specific settings: Now you need to add some mode-specific settings:
Select \guilabel{Win32 Release} in the \guilabel{Settings for} Select \guilabel{Release} in the \guilabel{Configuration}
dropdown list. Choose the \guilabel{Link} tab, choose the dropdown list. Choose the \guilabel{Link} tab, choose the
\guilabel{Input Category}, and append \code{pythonXY.lib} to the \guilabel{Input} category, and append \code{pythonXY.lib} to the
list in the \guilabel{Object/library modules} box. list in the \guilabel{Additional Dependencies} box.
Select \guilabel{Win32 Debug} in the \guilabel{Settings for} Select \guilabel{Debug} in the \guilabel{Configuration} dropdown
dropdown list, and append \code{pythonXY_d.lib} to the list in the list, and append \code{pythonXY_d.lib} to the list in the
\guilabel{Object/library modules} box. Then click the C/\Cpp{} \guilabel{Additional Dependencies} box. Then click the C/\Cpp{}
tab, select \guilabel{Code Generation} from the tab, select \guilabel{Code Generation}, and select
\guilabel{Category} dropdown list, and select \guilabel{Debug \guilabel{Multi-threaded Debug DLL} from the \guilabel{Runtime
Multithreaded DLL} from the \guilabel{Use run-time library} dropdown library} dropdown list.
list.
Select \guilabel{Win32 Release} again from the \guilabel{Settings Select \guilabel{Release} again from the \guilabel{Configuration}
for} dropdown list. Select \guilabel{Multithreaded DLL} from the dropdown list. Select \guilabel{Multi-threaded DLL} from the
\guilabel{Use run-time library:} dropdown list. \guilabel{Runtime library} dropdown list.
You should now create the file \file{spam.def} as instructed in the
previous section. Then chose the \menuselection{Insert \sub Files
into Project} dialog. Set the pattern to \code{*.*} and select
both \file{spam.c} and \file{spam.def} and click OK. (Inserting
them one by one is fine too.)
\end{enumerate} \end{enumerate}