From: Luis Lavena Date: 2010-08-01T07:19:01+09:00 Subject: [ruby-core:31567] [Bug #3637] win32ole: Remove definition of NONAMELESSUNION in MinGW Bug #3637: win32ole: Remove definition of NONAMELESSUNION in MinGW http://redmine.ruby-lang.org/issues/show/3637 Author: Luis Lavena Status: Open, Priority: Normal Category: ext, Target version: 1.9.x ruby -v: ruby 1.9.3dev (2010-07-31 trunk 28808) [i386-mingw32] 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. ---------------------------------------- http://redmine.ruby-lang.org