It was very much outdated, and the topic is better covered elsewhere.
The pyproject propertyfile defines _WIN32 and x64 defines _WIN64 and _M_X64\r
although the macros are set by the compiler, too. The GUI doesn't always know\r
about the macros and confuse the user with false information.\r
-\r
-YOUR OWN EXTENSION DLLs\r
------------------------\r
-\r
-If you want to create your own extension module DLL, there's an example\r
-with easy-to-follow instructions in PC/example/; read the file\r
-readme.txt there first.\r
+++ /dev/null
-#include "Python.h"
-
-static PyObject *
-ex_foo(PyObject *self, PyObject *args)
-{
- printf("Hello, world\n");
- Py_INCREF(Py_None);
- return Py_None;
-}
-
-static PyMethodDef example_methods[] = {
- {"foo", ex_foo, METH_VARARGS, "foo() doc string"},
- {NULL, NULL}
-};
-
-PyMODINIT_FUNC
-initexample(void)
-{
- Py_InitModule("example", example_methods);
-}
+++ /dev/null
-Microsoft Visual Studio Solution File, Format Version 8.00\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example.vcproj", "{A0608D6F-84ED-44AE-A2A6-A3CC7F4A4030}"\r
- ProjectSection(ProjectDependencies) = postProject\r
- EndProjectSection\r
-EndProject\r
-Global\r
- GlobalSection(SolutionConfiguration) = preSolution\r
- Debug = Debug\r
- Release = Release\r
- EndGlobalSection\r
- GlobalSection(ProjectConfiguration) = postSolution\r
- {A0608D6F-84ED-44AE-A2A6-A3CC7F4A4030}.Debug.ActiveCfg = Debug|Win32\r
- {A0608D6F-84ED-44AE-A2A6-A3CC7F4A4030}.Debug.Build.0 = Debug|Win32\r
- {A0608D6F-84ED-44AE-A2A6-A3CC7F4A4030}.Release.ActiveCfg = Release|Win32\r
- {A0608D6F-84ED-44AE-A2A6-A3CC7F4A4030}.Release.Build.0 = Release|Win32\r
- EndGlobalSection\r
- GlobalSection(ExtensibilityGlobals) = postSolution\r
- EndGlobalSection\r
- GlobalSection(ExtensibilityAddIns) = postSolution\r
- EndGlobalSection\r
-EndGlobal\r
+++ /dev/null
-<?xml version="1.0" encoding="windows-1250"?>\r
-<VisualStudioProject\r
- ProjectType="Visual C++"\r
- Version="7.10"\r
- Name="example"\r
- SccProjectName=""\r
- SccLocalPath="">\r
- <Platforms>\r
- <Platform\r
- Name="Win32"/>\r
- </Platforms>\r
- <Configurations>\r
- <Configuration\r
- Name="Release|Win32"\r
- OutputDirectory=".\Release"\r
- IntermediateDirectory=".\Release"\r
- ConfigurationType="2"\r
- UseOfMFC="0"\r
- ATLMinimizesCRunTimeLibraryUsage="FALSE">\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- Optimization="2"\r
- InlineFunctionExpansion="1"\r
- AdditionalIncludeDirectories="..\Include,..\PC"\r
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"\r
- StringPooling="TRUE"\r
- RuntimeLibrary="2"\r
- EnableFunctionLevelLinking="TRUE"\r
- UsePrecompiledHeader="2"\r
- PrecompiledHeaderFile=".\Release/example.pch"\r
- AssemblerListingLocation=".\Release/"\r
- ObjectFile=".\Release/"\r
- ProgramDataBaseFileName=".\Release/"\r
- WarningLevel="3"\r
- SuppressStartupBanner="TRUE"\r
- CompileAs="0"/>\r
- <Tool\r
- Name="VCCustomBuildTool"/>\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalOptions="/export:initexample"\r
- AdditionalDependencies="odbc32.lib odbccp32.lib python27.lib"\r
- OutputFile=".\Release/example.pyd"\r
- LinkIncremental="1"\r
- SuppressStartupBanner="TRUE"\r
- AdditionalLibraryDirectories="..\PCbuild"\r
- ModuleDefinitionFile=""\r
- ProgramDatabaseFile=".\Release/example.pdb"\r
- SubSystem="2"\r
- ImportLibrary=".\Release/example.lib"\r
- TargetMachine="1"/>\r
- <Tool\r
- Name="VCMIDLTool"\r
- PreprocessorDefinitions="NDEBUG"\r
- MkTypLibCompatible="TRUE"\r
- SuppressStartupBanner="TRUE"\r
- TargetEnvironment="1"\r
- TypeLibraryName=".\Release/example.tlb"\r
- HeaderFileName=""/>\r
- <Tool\r
- Name="VCPostBuildEventTool"/>\r
- <Tool\r
- Name="VCPreBuildEventTool"/>\r
- <Tool\r
- Name="VCPreLinkEventTool"/>\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- PreprocessorDefinitions="NDEBUG"\r
- Culture="1033"/>\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"/>\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"/>\r
- <Tool\r
- Name="VCWebDeploymentTool"/>\r
- <Tool\r
- Name="VCManagedWrapperGeneratorTool"/>\r
- <Tool\r
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>\r
- </Configuration>\r
- <Configuration\r
- Name="Debug|Win32"\r
- OutputDirectory=".\Debug"\r
- IntermediateDirectory=".\Debug"\r
- ConfigurationType="2"\r
- UseOfMFC="0"\r
- ATLMinimizesCRunTimeLibraryUsage="FALSE">\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- Optimization="0"\r
- AdditionalIncludeDirectories="..\Include,..\PC"\r
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"\r
- RuntimeLibrary="3"\r
- UsePrecompiledHeader="2"\r
- PrecompiledHeaderFile=".\Debug/example.pch"\r
- AssemblerListingLocation=".\Debug/"\r
- ObjectFile=".\Debug/"\r
- ProgramDataBaseFileName=".\Debug/"\r
- WarningLevel="3"\r
- SuppressStartupBanner="TRUE"\r
- DebugInformationFormat="4"\r
- CompileAs="0"/>\r
- <Tool\r
- Name="VCCustomBuildTool"/>\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalOptions="/export:initexample"\r
- AdditionalDependencies="odbc32.lib odbccp32.lib python27_d.lib"\r
- OutputFile=".\Debug/example_d.pyd"\r
- LinkIncremental="1"\r
- SuppressStartupBanner="TRUE"\r
- AdditionalLibraryDirectories="..\PCbuild"\r
- ModuleDefinitionFile=""\r
- GenerateDebugInformation="TRUE"\r
- ProgramDatabaseFile=".\Debug/example_d.pdb"\r
- SubSystem="2"\r
- ImportLibrary=".\Debug/example_d.lib"\r
- TargetMachine="1"/>\r
- <Tool\r
- Name="VCMIDLTool"\r
- PreprocessorDefinitions="_DEBUG"\r
- MkTypLibCompatible="TRUE"\r
- SuppressStartupBanner="TRUE"\r
- TargetEnvironment="1"\r
- TypeLibraryName=".\Debug/example.tlb"\r
- HeaderFileName=""/>\r
- <Tool\r
- Name="VCPostBuildEventTool"/>\r
- <Tool\r
- Name="VCPreBuildEventTool"/>\r
- <Tool\r
- Name="VCPreLinkEventTool"/>\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- PreprocessorDefinitions="_DEBUG"\r
- Culture="1033"/>\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"/>\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"/>\r
- <Tool\r
- Name="VCWebDeploymentTool"/>\r
- <Tool\r
- Name="VCManagedWrapperGeneratorTool"/>\r
- <Tool\r
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>\r
- </Configuration>\r
- </Configurations>\r
- <References>\r
- </References>\r
- <Files>\r
- <Filter\r
- Name="Source Files"\r
- Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90">\r
- <File\r
- RelativePath="example.c">\r
- <FileConfiguration\r
- Name="Release|Win32">\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- Optimization="2"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;$(NoInherit)"/>\r
- </FileConfiguration>\r
- <FileConfiguration\r
- Name="Debug|Win32">\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- Optimization="0"\r
- AdditionalIncludeDirectories=""\r
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;$(NoInherit)"/>\r
- </FileConfiguration>\r
- </File>\r
- </Filter>\r
- <Filter\r
- Name="Header Files"\r
- Filter="h;hpp;hxx;hm;inl;fi;fd">\r
- </Filter>\r
- <Filter\r
- Name="Resource Files"\r
- Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe">\r
- </Filter>\r
- <File\r
- RelativePath="readme.txt">\r
- </File>\r
- </Files>\r
- <Globals>\r
- </Globals>\r
-</VisualStudioProject>\r
+++ /dev/null
-Example Python extension for Windows NT
-=======================================
-
-This directory contains everything needed (except for the Python
-distribution!) to build a Python extension module using Microsoft VC++.
-Notice that you need to use the same compiler version that was used to build
-Python itself.
-
-The simplest way to build this example is to use the distutils script
-'setup.py'. To do this, simply execute:
-
- % python setup.py install
-
-after everything builds and installs, you can test it:
-
- % python -c "import example; example.foo()"
- Hello, world
-
-See setup.py for more details. alternatively, see below for instructions on
-how to build inside the Visual Studio environment.
-
-Visual Studio Build Instructions
-================================
-
-These are instructions how to build an extension using Visual C++. The
-instructions and project files have not been updated to the latest VC
-version. In general, it is recommended you use the 'setup.py' instructions
-above.
-
-It has been tested with VC++ 7.1 on Python 2.4. You can also use earlier
-versions of VC to build Python extensions, but the sample VC project file
-(example.dsw in this directory) is in VC 7.1 format.
-
-COPY THIS DIRECTORY!
---------------------
-This "example_nt" directory is a subdirectory of the PC directory, in order
-to keep all the PC-specific files under the same directory. However, the
-example_nt directory can't actually be used from this location. You first
-need to copy or move it up one level, so that example_nt is a direct
-sibling of the PC\ and Include\ directories. Do all your work from within
-this new location -- sorry, but you'll be sorry if you don't.
-
-OPEN THE PROJECT
-----------------
-From VC 7.1, use the
- File -> Open Solution...
-dialog (*not* the "File -> Open..." dialog!). Navigate to and select the
-file "example.sln", in the *copy* of the example_nt directory you made
-above.
-Click Open.
-
-BUILD THE EXAMPLE DLL
----------------------
-In order to check that everything is set up right, try building:
-
-1. Select a configuration. This step is optional. Do
- Build -> Configuration Manager... -> Active Solution Configuration
- and select either "Release" or "Debug".
- If you skip this step, you'll use the Debug configuration by default.
-
-2. Build the DLL. Do
- Build -> Build Solution
- This creates all intermediate and result files in a subdirectory which
- is called either Debug or Release, depending on which configuration you
- picked in the preceding step.
-
-TESTING THE DEBUG-MODE DLL
---------------------------
-Once the Debug build has succeeded, bring up a DOS box, and cd to
-example_nt\Debug. You should now be able to repeat the following session
-("C>" is the DOS prompt, ">>>" is the Python prompt) (note that various
-debug output from Python may not match this screen dump exactly):
-
- C>..\..\PCbuild\python_d
- Adding parser accelerators ...
- Done.
- Python 2.2c1+ (#28, Dec 14 2001, 18:06:39) [MSC 32 bit (Intel)] on win32
- Type "help", "copyright", "credits" or "license" for more information.
- >>> import example
- [7052 refs]
- >>> example.foo()
- Hello, world
- [7052 refs]
- >>>
-
-TESTING THE RELEASE-MODE DLL
-----------------------------
-Once the Release build has succeeded, bring up a DOS box, and cd to
-example_nt\Release. You should now be able to repeat the following session
-("C>" is the DOS prompt, ">>>" is the Python prompt):
-
- C>..\..\PCbuild\python
- Python 2.2c1+ (#28, Dec 14 2001, 18:06:04) [MSC 32 bit (Intel)] on win32
- Type "help", "copyright", "credits" or "license" for more information.
- >>> import example
- >>> example.foo()
- Hello, world
- >>>
-
-Congratulations! You've successfully built your first Python extension
-module.
-
-CREATING YOUR OWN PROJECT
--------------------------
-Choose a name ("spam" is always a winner :-) and create a directory for
-it. Copy your C sources into it. Note that the module source file name
-does not necessarily have to match the module name, but the "init" function
-name should match the module name -- i.e. you can only import a module
-"spam" if its init function is called "initspam()", and it should call
-Py_InitModule with the string "spam" as its first argument (use the minimal
-example.c in this directory as a guide). By convention, it lives in a file
-called "spam.c" or "spammodule.c". The output file should be called
-"spam.dll" or "spam.pyd" (the latter is supported to avoid confusion with a
-system library "spam.dll" to which your module could be a Python interface)
-in Release mode, or spam_d.dll or spam_d.pyd in Debug mode.
-
-Now your options are:
-
-1) Copy example.sln and example.vcproj, rename them to spam.*, and edit them
-by hand.
-
-or
-
-2) Create a brand new project; instructions are below.
-
-In either case, copy example_nt\example.def to spam\spam.def, and edit the
-new spam.def so its second line contains the string "initspam". If you
-created a new project yourself, add the file spam.def to the project now.
-(This is an annoying little file with only two lines. An alternative
-approach is to forget about the .def file, and add the option
-"/export:initspam" somewhere to the Link settings, by manually editing the
-"Project -> Properties -> Linker -> Command Line -> Additional Options"
-box).
-
-You are now all set to build your extension, unless it requires other
-external libraries, include files, etc. See Python's Extending and
-Embedding manual for instructions on how to write an extension.
-
-
-CREATING A BRAND NEW PROJECT
-----------------------------
-Use the
- File -> New -> Project...
-dialog to create a new Project Workspace. Select "Visual C++ Projects/Win32/
-Win32 Project", enter the name ("spam"), and make sure the "Location" is
-set to parent of the spam directory you have created (which should be a direct
-subdirectory of the Python build tree, a sibling of Include and PC).
-In "Application Settings", select "DLL", and "Empty Project". Click OK.
-
-You should now create the file spam.def as instructed in the previous
-section. Add the source files (including the .def file) to the project,
-using "Project", "Add Existing Item".
-
-Now open the
- Project -> spam properties...
-dialog. (Impressive, isn't it? :-) You only need to change a few
-settings. Make sure "All Configurations" is selected from the "Settings
-for:" dropdown list. Select the "C/C++" tab. Choose the "General"
-category in the popup menu at the top. Type the following text in the
-entry box labeled "Addditional Include Directories:"
-
- ..\Include,..\PC
-
-Then, choose the "General" category in the "Linker" tab, and enter
- ..\PCbuild
-in the "Additional library Directories" box.
-
-Now you need to add some mode-specific settings (select "Accept"
-when asked to confirm your changes):
-
-Select "Release" in the "Configuration" dropdown list. Click the
-"Link" tab, choose the "Input" Category, and append "python24.lib" to the
-list in the "Additional Dependencies" box.
-
-Select "Debug" in the "Settings for:" dropdown list, and append
-"python24_d.lib" to the list in the Additional Dependencies" box. Then
-click on the C/C++ tab, select "Code Generation", and select
-"Multi-threaded Debug DLL" from the "Runtime library" dropdown list.
-
-Select "Release" again from the "Settings for:" dropdown list.
-Select "Multi-threaded DLL" from the "Use run-time library:" dropdown list.
-
-That's all <wink>.
+++ /dev/null
-# This is an example of a distutils 'setup' script for the example_nt
-# sample. This provides a simpler way of building your extension
-# and means you can avoid keeping MSVC solution files etc in source-control.
-# It also means it should magically build with all compilers supported by
-# python.
-
-# USAGE: you probably want 'setup.py install' - but execute 'setup.py --help'
-# for all the details.
-
-# NOTE: This is *not* a sample for distutils - it is just the smallest
-# script that can build this. See distutils docs for more info.
-
-from distutils.core import setup, Extension
-
-example_mod = Extension('example', sources = ['example.c'])
-
-
-setup(name = "example",
- version = "1.0",
- description = "A sample extension module",
- ext_modules = [example_mod],
-)
dllbase_nt.txt A (manually maintained) list of base addresses for
various DLLs, to avoid run-time relocation.
-example_nt A subdirectory showing how to build an extension as a
- DLL.
Legacy support for older versions of Visual Studio
==================================================
doesn't always reflect the correct settings and may confuse the user\r
with false information, especially for settings that automatically adapt\r
for diffirent configurations.\r
-\r
-\r
-Your Own Extension DLLs\r
------------------------\r
-\r
-If you want to create your own extension module DLL (.pyd), there's an\r
-example with easy-to-follow instructions in ..\PC\example_nt\; read the\r
-file readme.txt there first.\r