Created
April 26, 2012 22:13
-
-
Save CootCraig/2503595 to your computer and use it in GitHub Desktop.
FFI failing on JRuby on Windows Server 2008
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FFI failing on JRuby on Windows Server 2008 | |
== Installed JRuby / JDK | |
$ jruby -v | |
jruby 1.6.7 (ruby-1.9.2-p312) (2012-02-22 3e82bc8) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_31) [Windows Server 2008-amd64-java] | |
== RubyInstalled devkit is installed for jruby 1.6.7 | |
DevKit-tdm-32-4.5.2-20111229-1559-sfx | |
== Gem file references FFI | |
$ cat Gemfile | |
source "http://rubygems.org" | |
gem "ffi" | |
== Install gem FFI | |
$ gem list | |
*** LOCAL GEMS *** | |
bundler (1.1.3) | |
rake (0.8.7) | |
sources (0.0.1) | |
$ gem install ffi --platform=ruby | |
Fetching: ffi-1.0.11.gem (100%) | |
Temporarily enhancing PATH to include DevKit... | |
Building native extensions. This could take a while... | |
Successfully installed ffi-1.0.11 | |
1 gem installed | |
$ gem list | |
*** LOCAL GEMS *** | |
bundler (1.1.3) | |
ffi (1.0.11) | |
rake (0.8.7) | |
sources (0.0.1) | |
$ gem list | |
*** LOCAL GEMS *** | |
bundler (1.1.3) | |
rake (0.8.7) | |
sources (0.0.1) | |
== Test program | |
$ cat 01_ffi_cvlancli.rb | |
require "rubygems" | |
require "bundler/setup" | |
Bundler.require(:default) | |
#require 'ffi' | |
module CvlanLib | |
extend FFI::Library | |
if false | |
ffi_lib Gem.bin_path('cvlan_lib','cvlancli.dll') | |
else | |
ffi_lib 'cvlancli.dll' | |
end | |
attach_function :asai_open, [:string, :int], :int | |
end | |
fd = CvlanLib.asai_open('localhost', 0) | |
puts "asai_open fd=#{fd}" | |
== Program fails | |
$ jruby --debug 01_ffi_cvlancli.rb | |
LoadError: Could not open library 'cvlancli.dll' : The operation completed succe | |
ssfully. | |
ffi_lib at c:/jruby/jruby-1.6.7/lib/ruby/site_ruby/shared/ffi/library.rb:82 | |
collect at org/jruby/RubyArray.java:2331 | |
collect at org/jruby/RubyArray.java:2339 | |
ffi_lib at c:/jruby/jruby-1.6.7/lib/ruby/site_ruby/shared/ffi/library.rb:64 | |
CvlanLib at 01_ffi_cvlancli.rb:11 | |
(root) at 01_ffi_cvlancli.rb:6 | |
-------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment