Some notes on how to build Perl with the free toolkit have recently been added to the README.win32 file (aka perlwin32 manpage) that comes with Perl. These notes are in the current development stream, and will hopefully be in the next release of Perl (5.8.6).
For those who can't wait, here's what the new notes say:
Microsoft Visual C++ Toolkit 2003
This free toolkit contains the same compiler and linker that ship with Visual Studio .NET 2003 Professional, but doesn't contain everything necessary to build Perl.
You will also need to download the "Platform SDK" (the "Core SDK" and "MDAC SDK" components are required) for header files, libraries and rc.exe, and ".NET Framework SDK" for more libraries and nmake.exe. Note that the latter (which also includes the free compiler and linker) requires the ".NET Framework Redistributable" to be installed first. This can be downloaded and installed separately, but is included in the "Visual C++ Toolkit 2003" anyway.
These packages can all be downloaded by searching in the Download Center at http://www.microsoft.com/downloads/search.aspx?displaylang=en
Note that the "Platform SDK February 2003" download requires Internet Explorer 5.0 to function. Alternatively, the very latest version at the time of writing (called "Windows XP Service Pack 2 Platform SDK RC2") is now available as an ISO-9660 CD image file and does not require IE5 to be downloaded but will only work on Windows XP.
According to the download pages the Toolkit and the .NET Framework SDK are only supported on Windows 2000/XP/2003, so trying to use these tools on Windows 95/98/ME and even Windows NT probably won't work.
Install the Toolkit first, then the Platform SDK, then the .NET Framework SDK. Setup your environment as follows (assuming default installation locations were chosen):
SET PATH=%SystemRoot%\system32;%SystemRoot%;C:\Program Files\Micro
+soft Visual C++ Toolkit 2003\bin;C:\Program Files\Microsoft SDK\Bin;C
SET INCLUDE=C:\Program Files\Microsoft Visual C++ Toolkit 2003\inc
+lude;C:\Program Files\Microsoft SDK\include;C:\Program Files\Microsof
+t Visual Studio .NET 2003\Vc7\include
SET LIB=C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib;C:\
+Program Files\Microsoft SDK\lib;C:\Program Files\Microsoft Visual Stu
+dio .NET 2003\Vc7\lib
Several required files will still be missing:
Perl should now build using the win32/Makefile. You will need to edit that file to comment-out CCTYPE = MSVC60 (since that enables delay-loading of the Winsock DLL which the free toolkit does not support) and to set CCHOME, CCINCDIR and CCLIBDIR as per the environment setup above.
cvtres.exe is required by link.exe when using a .res file. It is actually installed by the .NET Framework SDK, but into a location such as the following:
Copy it from there to C:\Program Files\Microsoft SDK\Bin
lib.exe is normally used to build libraries, but link.exe with the /lib option also works, so create a batch file called lib.bat in C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin containing:
link /lib %*
This will work as long as "lib.exe" is invoked simply as "lib" (which it is during the Perl build process).
setargv.obj is required to build perlglob.exe (and perl.exe if the USE_SETARGV option is enabled). The Platform SDK supplies this object file in source form in C:\Program Files\Microsoft SDK\src\crt. Copy setargv.c, cruntime.h and
internal.h from there to some temporary location and build setargv.obj using
cl.exe /c /I. /D_CRTBLD setargv.c
Then copy setargv.obj to C:\Program Files\Microsoft SDK\lib
Note that Perl should be unpacked into a directory path that does not contain any spaces otherwise MakeMaker will experience some problems. There is no harm in having the MS toolkit and other packages installed into their default C:\Program Files locations.
Also note that if you are going to use the free toolkit to build C extension modules then you should use the same compiler as was used to build Perl. ActivePerl is currently built using MSVC6, so its perl.exe is linked against MSVC6's msvcrt.lib and depends on the OS's msvcrt.dll. The new toolkit (MSVC7) has an msvcrt.lib which produces binaries depending on msvcrt71.dll. So if you use the free toolkit to build modules for ActivePerl then you'll end up loading two different C runtime DLL's and you will run into trouble if any CRT resources (e.g. file decriptors) get passed between them. If you're going to build modules with the free toolkit then you're best off rebuilding Perl with it yourself too.