1 2VisualStudio instructions 3 4libpng version 1.4.3 - June 26, 2010 5 6Copyright (c) 1998-2010 Glenn Randers-Pehrson 7 8This code is released under the libpng license. 9For conditions of distribution and use, see the disclaimer 10and license in png.h 11 12This directory contains support for building libpng under MicroSoft 13VisualStudio 2010. It may also work under later versions of VisualStudio. 14You should be familiar with VisualStudio before using this directory. 15 16This is a slightly modified copy of the 'vstudio' solution from libpng 171.5; it is intended to provide compatibility for libpng 1.4 with later 18releases of zlib (from 1.2.4) and to provide a migration aid for 1.5. 19 20A 'VB' DLL is no longer produced - use the standard 'Release' DLL. 21 22Initial preparations 23==================== 24You should install the 'official' build of zlib on your system - follow the 25instructions provided on http://www.zlib.net. When a new release is being 26made of zlib the instructions disappear for a while until the new official 27build is available. You will have to wait. 28 29You must enter some information in zlib.props before attempting to build 30with this 'solution'. Please read and edit zlib.props first. You will 31probably not be familiar with the contents of zlib.props - do not worry, 32it is mostly harmless. 33 34Make sure that your official build layout matches the requirements listed 35in zlib.props. Prior to zlib-1.2.4 the official build (1.2.3) placed 36include and library files in different directories - if you find this 37has happened just put them all in the same directory. 38 39This is all you need to do to build the 'release' and 'release library' 40configurations. 41 42Debugging 43========= 44The release configurations default to /Ox optimization. Full debugging 45information is produced (in the .pdb), but if you encounter a problem the 46optimization may make it difficult to debug. Simply rebuild with a lower 47optimization level (e.g. /Od.) 48 49Stop reading here 50================= 51You have enough information to build a working application. 52 53Debug versions have limited support 54=================================== 55This solution includes limited support for debug versions of libpng. You 56do not need these unless your own solution itself uses debug builds (it is 57far more effective to debug on the release builds, there is no point building 58a special debug build.) 59 60If, despite the previous paragraph, you still feel you need a debug build you 61will have to download the zlib source as well (http://www.zlib.net) and include 62the directory where you unpack it in zlib.props. This solution will then be 63able to build a minimal zlib sufficient for libpng. This build is only 64suitable for making a debug libpng. 65 66The debug build of libpng is minimally supported. Support for debug builds of 67zlib is also minimal. You really don't want to do this. 68 69This solution only supports the Multi-Threaded DLL C Runtime 70============================================================ 71If you examine the solution you will find that it very deliberately lists 72exactly which MicroSoft DLLs it is linking against. It explicitly links 73against msvcrt.lib. The debug version links against msvcrtd.lib (this is 74why it is a debug version - it's nothing to do with having any special 75debug support, it doesn't). 76 77These versions of the MicroSoft C runtime correspond to the compiler flags 78/MD (release) and /MDd (debug) - the "Multi-Threaded DLL" implementation of the 79C runtime library. 80 81If you need to change this then you will have to make sure that both the 82compiler flags and the ".lib" in the linker dependences match up. Fortunately 83neither zlib nor libpng require libraries other than a C runtime and 84kernel32. 85 86You cannot pass (FILE*) objects from a different runtime (including msvcrtd 87to msvcrt) to libpng. If you do then your program will crash within libpng 88when it first makes a file read or write call. 89 90It is likely if you have read this far that you have found you can't avoid 91having multiple C runtimes in your program. This is OK, it does work, but 92you will have to implement the libpng file read/write callbacks rather than 93using the internal libpng default. This is easy. 94