[Image-SIG] Building PIL with Windows NT, Python 1.6
Jonathan M. Gilligan
Tue, 19 Sep 2000 10:46:19 -0500
I have succeeded in building PIL under Windows and Python 1.6 with VC++ 6.0
SP4. Since others may need to do this, I provide an outline of what I did:
Make a new Visual C++ workspace in the Imaging-1.1 directory. Put two
projects in it: "_imaging" and "_imagingtk". Both of these projects should
be "Win32 DLL" (NOT MFC DLL) projects. Tell the AppWizard to make them
empty projects. To "_imaging" add all *.c *.h in Imaging-1.1 and
Imaging-1.1\libImaging except _imagingtk.c, tkImaging.c, Except.c, and
coretest.c. To "_imagingtk" add "_imagingtk.c" and "tkImaging.c".
Set the output (in the Project/Settings/Link property page) to _imaging.dll
and _imagingtk.dll. Case is important. Python matches case on .dll file names.
Add appropriate Include and Lib directories to your C++ preprocessor and
linker search path settings for python16, jpeg, zlib, tcl, and tk. Add
python16.lib, tcl83.lib, tk83.lib, jpeg.lib, zlib.lib (use the fully
qualified path to the zlib.lib from your zlib distribution so the linker
will not get confused by the zlib.lib in python, which is for zlib.pyd and
will not work) to the Link Input "Object/Library modules" list.
Set the C++ language options to use the "Multithreaded DLL" for the runtime
Edit the PIL source code to delete or comment out all lines defining or
undefining INT32 and UINT32. These are typedef'ed in standard Platform SDK
and Visual C++ header files <basetsd.h> and combining typedefs and
preprocessor definitions for the same symbol will produce beaucoup compiler
errors. (Note to /F: If you can do it for a future release, please rename
your preprocessor definitions to something like PIL_INT32 etc.)
Now build with Visual C++. After successfully building, copy _imaging.dll
and _imagingtk.dll to your python DLLs directory. Then add the following
key to your registry:
In this key add a default value (i.e., blank name for the value) of type
REG_SZ and contents "D:\Program Files\Python\Imaging-1.1\PIL" or wherever
your PIL *.py files are.
Now PIL should work.
Jonathan M. Gilligan <email@example.com>