[Zlib-devel] visual studio linking against msvcrt.dll
Berke Viktor
berkeviktor at aol.com
Sun Mar 28 17:58:40 EDT 2010
helo,
there are vc9 and vc10 solutions in the zlib source tree. this makes it
easy to build the zlib libraries. there's one problem, however: they
link against msvcr90.dll (with vc9). that means, they won't work on xp
until the vcredist package is installed. xp only has msvcrt.dll.
this can be solved by updating the solutions to use the windows driver
kit libs and headers. this causes the build to link against the old
msvcrt.dll found in windows xp.
more info: http://winbuild.daydreamer.nu/
you can find a sample solution in every zlib build on this site. the
solution and project files have to be copied to
zlib-1.2.4\projects\visualc6.
an important note: debug is problematic coz there's no debug version of
msvcrt (msvcrtd.dll). more info about these can be found in the archive
articles on the winbuild site.
it would be great if these modifications could be applied to zlib (at
least for RELEASE), and then official x86 and x64 builds could be
released which could be used across all windows versions from xp to 7.
to update the solution files, one has to:
1) add wdk include dirs
AdditionalIncludeDirectories="c:\WinDDK\7600.16385.1\inc\api;c:\WinDDK\7600.16385.1\inc\crt"
2) add wdk lib dirs
AdditionalLibraryDirectories="c:\WinDDK\7600.16385.1\lib\wxp\i386;c:\WinDDK\7600.16385.1\lib\Crt\i386"
(for x86)
AdditionalLibraryDirectories="c:\WinDDK\7600.16385.1\lib\wnet\amd64;c:\WinDDK\7600.16385.1\lib\Crt\amd64"
(for x64)
3) add msvcrt_winxp.obj or msvcrt_win2003.obj for xp x86 or xp x64
respectively (xp64 is in fact a rebranded ws2003 x64).
AdditionalDependencies="odbc32.lib odbccp32.lib msvcrt_winxp.obj"
(x86)
AdditionalDependencies="odbc32.lib odbccp32.lib msvcrt_win2003.obj"
(x64)
then zlib still could be built using just free tools, and the need for
vcredist could be eliminated. VC Express is free, and WDK is free, too.
wdk:
http://www.microsoft.com/downloads/details.aspx?FamilyID=36a2630f-5d56-43b5-b996-7633f2ec14ff
vc express:
http://www.microsoft.com/downloads/details.aspx?FamilyID=f3fbb04e-92c2-4701-b4ba-92e26e408569
of course then the documentation should be updated to instruct users to
install WDK along with their version of VS.
and that's just about it. you can check out the results with depends:
http://www.dependencywalker.com/
and you'll see the difference.
feel free to ask questions.
More information about the Zlib-devel
mailing list