Bug #3637
closedwin32ole: Remove definition of NONAMELESSUNION in MinGW
Description
=begin
Hello,
I'm working in cross compiling Ruby to Windows (GCC) using moderm GCC versions, provided by mingw-w64 team targeting 32bits mode.
In this work, I found win32ole tries to define access to members of nameless union.
According to mingw-w64 developers, these hacks access were needed with older versions of GCC (prior 3.4) but nowdays are no longer required.
Looking at the source of these changes, dates 2002 (!) which is way before GCC 3.4
The following patch removes the definition of NONAMELESSUNION under MinGW and allows correct compilation under GCC 3.4.5, GCC 4.5.0 and cross-compilation under GCC 4.5.1 (experimental)
diff --git a/ext/win32ole/extconf.rb b/ext/win32ole/extconf.rb
index b4f09fc..d566be2 100644
--- a/ext/win32ole/extconf.rb
+++ b/ext/win32ole/extconf.rb
@@ -38,7 +38,7 @@ end
case RUBY_PLATFORM
when /mswin/
$CFLAGS += ' /W3'
-when /cygwin/, /mingw/
+when /cygwin/
$defs << '-DNONAMELESSUNION'
end
create_win32ole_makefile
mingw-w64 developers suggest a check for GCC version instead of NONAMELESSUNION definition.
I believe this also should be backported to 1.9.2, 1.9.1 and 1.8 branches.
Thank you.
=end