Subject: [ruby-ffi] puts example fails in doze |
From: rogerdpack |
Date: 12/11/09 4:58 PM |
To: ruby-ffi |
in windows, this code fails: require 'ffi' module Hello extend FFI::Library attach_function 'puts', [:string], :int end Hello.puts("Hello, World") thusly: C:\dev\ruby\ruby-benchmark-suite\benchmarks\micro-benchmarks>ruby -v test.rb ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32] C:/installs/ruby-1.9.1-p243-tweaked/lib/ruby/gems/1.9.1/gems/ sane-0.11.0/lib/sane/hash_set_operators_bug_fix.rb:4: warning: method redefined; discarding old - #<FFI::NotFoundError: Function 'puts' not found in [[current process]]> Function 'puts' not found in [[current process]] C:/installs/ruby-1.9.1-p243-tweaked/lib/ruby/gems/1.9.1/gems/ffi-0.5.4- x86-mingw32/lib/ffi/library.rb:77:in `attach_function' raise FFI::NotFoundError.new(cname.to_s, ffi_libraries.map { | lib| lib.name }) unless invoker test.rb:5:in `<module:Hello>' attach_function 'puts', [:string], :int test.rb:3:in `<main>' module Hello <main>: Function 'puts' not found in [[current process]] (FFI::NotFoundError) Is this expected? Is there an example function that should work cross platform? -r