=======================================\r
\r
This directory contains everything you need to build a Python\r
-extension module using Microsoft VC++ 4.x ("Developer Studio"), except\r
-for the Python distribution. It has been tested most recently with\r
-version 4.2. (Yes, it has been tested with the latest Python 1.5a3.)\r
+extension module using Microsoft VC++ ("Developer Studio") version 4.x\r
+or 5.x, except for the Python distribution. It has been tested with\r
+VC++ 4.2 on Python 1.5a3, and with VC++ 5.0 on Python 1.5b2.\r
\r
The "example_nt" subdirectory should be an immediate subdirectory of\r
the Python source directory -- a direct sibling of Include and PC, in\r
specific files inside the PC subdirectory of the distribution, where\r
they belong.)\r
\r
-It is also assumed that the build results of Python are in the\r
-directory ..\vc40. In particular, the python15.lib file is referred\r
-to as "..\vc40\python15.lib". If you have problems with this file,\r
-the best thing to do is to delete it from the project and add it\r
-again.\r
+When using the VC++ 4.x project (makefile), it is assumed that the\r
+build results of Python are in the directory ..\vc40. In particular,\r
+the python15.lib file is referred to as "..\vc40\python15.lib". If\r
+you have problems with this file, the best thing to do is to delete it\r
+from the project and add it again.\r
\r
-In order to use the example project from Developer Studio, use the\r
-"File->Open Workspace..." dialog (*not* the "File->Open..." dialog!).\r
-Change the pattern to "*.mak" and select the file "example.mak". Now\r
-choose "File->Save All" and the othe project files will be created.\r
+When using the VC++ 5.x project (workspace), the build results of\r
+Python are assumed to be in ..\PCbuild. Since the provided VC++ 5.x\r
+project and workspace files have a different structure (to support\r
+separate "release" and "debug" builds), the example project and\r
+workspace match this structure.\r
+\r
+In order to use the example project from VC++ 4.x, use the "File->Open\r
+Workspace..." dialog (*not* the "File->Open..." dialog!). Change the\r
+pattern to "*.mak" and select the file "example.mak". Now choose\r
+"File->Save All" and the othe project files will be created.\r
+\r
+From VC+ 5.x, do the same except don't change the pattern, and select\r
+the example.dsw workspace file.\r
\r
In order to check that everything is set up right, try building:\r
choose "Build->Build example.dll". This creates all intermediate and\r
result files in a subdirectory which is called either Debug or Release\r
-depending on which configuration you have chosen (as distributed,\r
-Debug is selected as the default configuration).\r
+depending on which configuration you have chosen.\r
\r
Once the build has succeeded, test the resulting DLL. In a DOS\r
command window, chdir to that directory. You should now be able to\r
Hello, world\r
>>>\r
\r
+When using VC++ 5.x, issue these commands:\r
+\r
+ C> ..\..\PCbuild\Release\python.exe\r
+ >>> import example\r
+ >>> example.foo()\r
+ Hello, world\r
+ >>>\r
+\r
\r
Creating the project\r
--------------------\r
occurrences of the string "example" by "spam", and all occurrences of\r
"DEP_CPP_EXAMP" by something like "DEP_CPP_SPAM". You can now use\r
this makefile to create a project file by opening it as a workspace\r
-(you have to change the pattern to *.mak first).\r
+(you have to change the pattern to *.mak first). (When using VC++\r
+5.x, you can clone example.dsp and example.dsw in a similar way.)\r
\r
2) Create a brand new project; instructions are below.\r
\r
In both cases, copy example_nt\example.def to spam\spam.def, and edit\r
spam\spam.def so its second line contains the string "initspam". If\r
you created a new project yourself, add the file spam.def to the\r
-project now.\r
+project now. (This is an annoying little file with only two lines.\r
+An alternative approach is to forget about the .def file, and add the\r
+option "/export:initspam" somewhere to the Link settings, by manually\r
+editing the "Project Options" box).\r
\r
You are now all set to build your extension, unless it requires other\r
external libraries, include files, etc. See Python's Extending and\r
Creating a brand new project\r
----------------------------\r
\r
-If you don't feel comfortable with editing Makefiles, you can create a\r
-brand new project from scratch easily.\r
+If you don't feel comfortable with editing Makefiles or project and\r
+workspace files, you can create a brand new project from scratch\r
+easily.\r
\r
Use the "File->New..." dialog to create a new Project Workspace.\r
Select Dynamic-Link Library, enter the name ("spam"), and make sure\r
\r
..\Include,..\PC\r
\r
-You must also change the run-time library. This must be done\r
+Next, for both configurations, select the "Link" tab, choose the\r
+"General" category, and add "python15.lib" to the end of the\r
+"Object/library modules" box.\r
+\r
+Then, separately for the Release and Debug configurations, choose the\r
+"Input" category in the Link tab, and enter "..\PCbuild\Release" or\r
+"..\PCbuild\Debug", respectively, in the "Additional library path"\r
+box.\r
+\r
+Finally, you must change the run-time library. This must also be done\r
separately for the Release and Debug configurations. Choose the "Code\r
Generation" category in the C/C++ tab. In the box labeled "Use\r
run-time library", choose "Multithreaded DLL" for the Release\r
\r
Now chose the "Insert->Files into Project..." dialog. Set the pattern\r
to *.* and select both spam.c and spam.def and click OK. (Inserting\r
-them one by one is fine too.) Using the same dialog, choose the file\r
-..\vc40\python15.lib and insert it into the project.\r
+them one by one is fine too.)\r
+\r