[Win32utils-devel] Building zlib with Visual Studio

Heesob Park phasis at gmail.com
Mon May 7 06:06:43 UTC 2012


Hi,

2012/5/7 Daniel Berger <djberg96 at gmail.com>

> Hi,
>
> I noticed that the current C zlib source includes VS solutions under
> the "contrib" directory. I built the VC10 project solution, and it
> seemed to build all the necessary files, though it named them
> zlibwapi.dll and zlibwapi.lib. Anyway, inspecting the generated .dll
> files indicates that the deflateReset function was exported:
>
> dumpbin /exports zlibwapi.dll
> 10   10 0003918B deflateReset = @ILT+390(_deflateReset at 4)
>
> dumpbin /exports zlibwapi.lib
> 10    _deflateReset at 4
>
> But it doesn't seem to actually export it. BTW, I stuck the headers
> under c:/usr/local/zlib/include and the libs under
> c:/usr/local/zlib/lib.
>
> # ruby extconf.rb --with-zlib-dir=c:/usr/local/zlib
> require 'mkmf'
> dir_config 'zlib'
>
> have_header 'zlib.h' # yes
> have_library 'zlibwapi' # yes
> have_library 'zlibwapi', 'deflateReset' # no ???
>
> I did try rebuilding the .lib file from the .def file and at first
> that seemed to fix things, but Ruby segfaulted the moment I tried to
> run a "gem install" command.
>
> Any ideas?
>
> According to the readme.txt in contrib/vstudio, zlibwapi.dll is built
with ZLIB_WINAPI macro and used WINAPI convention.
Because Ruby's zlib.c uses cdecl calling convention, Ruby failed with
segfault.

When I removed ZLIB_WINAPI from preprocessor definition and build dll
again, I succeed to run "gem install rake".

Regards,
Park Heesob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/win32utils-devel/attachments/20120507/bf52b6fb/attachment.html>


More information about the win32utils-devel mailing list