From: Heesob Park Date: 2009-03-04T00:35:25+09:00 Subject: Re: Windows 7 - building win32/api gem Hi, 2009/3/3 Stanislaw Wozniak : > Hi Guys, > > I have been trying to install win32-api 1.4.0 gem on windows 7 x64 but > no success. > > When i install x86 version, require 'win32/api' gives me following > error: > > LoadError: 193: %1 is not a valid Win32 application.   - > c:/ruby/lib/ruby/gems/1.9.1/gems/win32-api-1.4.0-x86-mswin32-60/lib/win32/api.so >        from (irb):1:in `require' >        from (irb):1 >        from c:/ruby/bin/irb.bat:20:in `
' > > My ruby: > ruby 1.9.1p0 (2009-01-30 revision 21907) [x64-mswin64_80] > > My gems: > 1.3.1 > > I have VS2008 installed and even managed to create a makefile but it > complains about following: > > C:\>gem install win32-api > Building native extensions.  This could take a while... > ERROR:  Error installing win32-api: >        ERROR: Failed to build gem native extension. > > c:/ruby/bin/ruby.exe extconf.rb install win32-api > checking for strncpy_s()... yes > creating Makefile > > nmake > > Microsoft (R) Program Maintenance Utility Version 9.00.21022.08 > Copyright (C) Microsoft Corporation.  All rights reserved. > >        c:\ruby\bin\ruby -e "puts 'EXPORTS', 'Init_api'"  > > api-x64-mswin64_80.def >        cl -nologo -I. -Ic:/ruby/include/ruby-1.9.1/x64-mswin64_80 > -Ic:/ruby/include/ruby-1.9.1/ruby/backward -Ic:/ruby/include/ruby-1.9.1 > -Iwin32 -MD -Zi  -O2b > 2xty-  -Zm600 -DHAVE_STRNCPY_S -D_CRT_SECURE_NO_DEPRECATE > -D_CRT_NONSTDC_NO_DEPRECATE -Foapi.obj -c -Tcwin32/api.c > api.c ... > > Does anyone have any idea about building gem on windows? Or maybe you > have precompiled api.so on your x64 system. > I guess you tried to build win32-api module with Visual C++ 9.0. You must use the same compiler with the Ruby version(x64-mswin64_80). After some trials and errors, I managed to build win32-api module with Visual C++ 8.0. You can download at http://121.78.227.9/win32-api-1.4.0/lib/win32/api.so NB, Using win32utils on the 64bit Ruby is not tested. Regards, Park Heesob