1. Open a command line window
2. C:>\ "(visual studio install directory)\Microsoft Visual Studio 10.0\VC\bin\amd64\vsvars32.bat"
3. C:>\ set path="(visual studio install directory)\Microsoft Visual Studio 10.0\VC\bin\amd64\";%path%
This is to enable the system to find "ml64.exe" when we execute the next command
4. C:>\ cd "(zlib directory)\contrib\masmx64"
5. D:\zlib\> bld_ml64.bat
This batch file will compile two assembly files into corresponding object files: inffasx64.obj and gvmat64.obj. If you want to compile into 32bit library, just replace masmx64 with masmx32, and bld_ml64.bat with bld_ml32.bat.
6. Open "(zlib directory)\contrib\vstudio\vc10\zlibvc.sln" with VS2012, and choose to update the solution. Of course you can also use VS2010, but it may pop up an error saying "error LNK1123. failure during conversion to COFF". It is said that installing SP1
of VS2010 may solve it. But I didn't try.
7. Open the project property of "zlibvc" -> Build Events -> Pre-Build Event -> Command Line. Clean the "Command Line" field. You can see that the they are trying to execute the bld_ml64.bat file. But somehow it does not work. If you don't clean the command line, you will get an error when compiling, saying "bld_ml64.bat is not recognized as command or executable".
8. Modify "zlibvc.def" line 4 from "VERSION 1.2.7" to "VERSION 1.2". Visual Studio seems to support only "Major.Minor" version number. If you don't do this, you get a "LNK1118: syntax error in 'VERSION' statement" message.
9. Compile the solution.
10. Now you should have dll and lib files generated in "(zlib directory)\contrib\vstudio\vc10\x64\ZlibDllRelease". Include "zlib.h" and link to dll or lib files in your project, and you should be able to use zlib.