Unable to call win32-api

Hi

I’m new to Ruby and am trying to write a small ruby script to call
win32-api

from scratch, here’s what I’ve done

installed Ruby 2.0 using the ruby installer (rubyinstaller-2.0.0-p0.exe)
installed the associated devkit
(DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe)
ensure that both bin dirs are on PATH

Here’s the error I see when I try to run the script

C:\Ruby\Ruby200\bin\ruby.exe -e
$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)
D:/kaira/src/ruby/main/myruby.rb
C:/Ruby/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in
require': cannot load such file -- win32/api (LoadError) from C:/Ruby/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:inrequire’
from D:/kaira/src/ruby/main/myruby.rb:1:in <top (required)>' from -e:1:inload’
from -e:1:in `’

my line 1 is require ‘win32/api’, so it appears I’m missing that, or at
least its not compiled correctly somehow.

Having googled this for a while, the stock recommendation is to
recompile the win32-api from source, which I did

gem uninstall win32-api
gem install win32-api --platform=ruby

This succeeded but didn’t resolve the issue.

Originally I started with the 64 bit versions of Ruby 2.0/DevKit as I’m
running Window 7 64bit, although I have now switched to 32bit
Ruby2.0/DevKit, again no luck.

my installs are in
C:\Ruby\Ruby200
C:\Ruby\DevKit

my PATH starts with
PATH=C:\Ruby\Ruby200\bin;C:\Ruby\DevKit\bin; …

Maybe I’m missing something obvious here, although I can’t spot it. Any
help appreciated.

Thanks

Hi,

2013/4/30 Craig S. [email protected]:

ensure that both bin dirs are on PATH
C:/Ruby/Ruby200/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in

C:\Ruby\Ruby200
C:\Ruby\DevKit

my PATH starts with
PATH=C:\Ruby\Ruby200\bin;C:\Ruby\DevKit\bin; …

Maybe I’m missing something obvious here, although I can’t spot it. Any
help appreciated.

It seems that win32-api is not compatible with ruby 2.0.0.
I recommend to use Ruby FFI instead of win32-api,
If you want to use win32-api, make an issue on
https://github.com/djberg96/win32-api/issues.

Regards,
Park H.

Thank you. I didn’t really need Ruby 2.0 so switched to 1.9, problem
solved.

Regards