From: noreply@... Date: 2005-08-04T15:11:15+09:00 Subject: [ ruby-Bugs-2206 ] Building ruby extensions with MingW broken Bugs item #2206, was opened at 2005-08-04 00:05 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2206&group_id=426 Category: None Group: None Status: Open Resolution: None Priority: 3 Submitted By: Charlie Savage (cfis) Assigned to: Nobody (None) Summary: Building ruby extensions with MingW broken Initial Comment: Setup - Windows XP sp2, windows ruby 1.8.2 build, mingw with gcc 3.4.4 When I build an extension called "my_test" (from the pick axe book) using mingw I get an error when loading the extension: $ ruby -C . -e "require 'my_test'" ./my_test.so: wrong argument type Fixnum (expected Class) (TypeError) from c:/Development/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require' from -e:1 Digging into this, it happens because __declspec(dllimport) is not being set correctly because of these lines in defines.h: #undef RUBY_EXTERN #if defined _WIN32 && !defined __GNUC__ # ifndef RUBY_EXPORT # define RUBY_EXTERN extern __declspec(dllimport) # endif #endif __GNUC__ is true, thus the __declspec(dllimport) is not included. A simple fix could be: #if defined _WIN32 && (!defined __GNUC__ || defined __declspec) -or- # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) || define(__MINGW32__) And I'm sure there are others. Note I originally reported this to the Mingw list. For a lot more detailed information please see: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=1251320&group_id=2435 Thanks, Charlie ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=2206&group_id=426