Bug #4214: Fiddle::WINDOWS =3D=3D false on Windows
http://redmine.ruby-lang.org/issues/show/4214

Author: Jon Forums
Status: Open, Priority: Normal
Assigned to: Aaron Patterson, Category: ext, Target version: 1.9.2
ruby -v: ruby 1.9.2p136 (2010-12-25 revision 30363) [i386-mingw32]

<pre>
<code>
C:\Users\Jon>ruby --version
ruby 1.9.2p136 (2010-12-25 revision 30363) [i386-mingw32]

C:\Users\Jon>ruby -e "require 'fiddle';puts Fiddle::WINDOWS"
false
</code>
</pre>

The root cause was that configure.in never checked for windows.h. Consequ=
ently, on Windows, .ext/include/i386-mingw32/ruby/config.h never defined =
the HAVE_WINDOWS_H macro used by fiddle in ext/fiddle/{fiddle.c,fiddle.h,=
function.c}. FYI, the HAVE_WINDOWS_H macro is also used by ext/dl/{cfunc.=
c,dl.h,handle.c} but I've not tested the DL code on Windows. Fiddle and D=
L appear to be the only places in the code that HAVE_WINDOWS_H is checked=
.

After the attached patch on trunk@30404 I get

<pre>
<code>
C:\Users\Jon>ruby --version
ruby 1.9.3dev (2010-12-27 trunk 30404) [i386-mingw32]

C:\Users\Jon>ruby -e "require 'fiddle';puts Fiddle::WINDOWS"
true
</code>
</pre>

The patch was tested on (a) Windows 7 Ultimate 32-bit using the RubyInsta=
ller build recipes, (b) Arch Linux 2.6.36 32-bit, and (c) Arch Linux 32-b=
it cross-compiled for Windows.  Running @make test-all TESTS=3Dfiddle@ pa=
sses on both Win7 and Arch. The portion of the patch relating to win32/Ma=
kefile.sub is speculative as I don't build with VC. Perhaps Park H. or th=
e mswin32 maintainer will verify.

Please backport an acceptable version of the patch to ruby_1_9_2 at your =
earliest convenience.

Jon


----------------------------------------
http://redmine.ruby-lang.org
ZGlmZiAtLWdpdCBhL2NvbmZpZ3VyZS5pbiBiL2NvbmZpZ3VyZS5pbgppbmRl
eCAzYTE5OTljLi5lMDU0ODQxIDEwMDY0NAotLS0gYS9jb25maWd1cmUuaW4K
KysrIGIvY29uZmlndXJlLmluCkBAIC0xMTAxL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