Created
January 17, 2010 21:47
-
-
Save emonti/279607 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# copy and paste this into IRB... | |
# | |
require 'ffi' | |
class Foo < FFI::Struct | |
layout :ary, [:uint16, 10] | |
end | |
f = Foo.new | |
# => #<Foo:0x19bb51c> | |
f[:ary].class | |
# => FFI::Struct::InlineArray | |
# and something with InlineArray is broken... | |
f[:ary] | |
# NoMethodError: to_s not defined for this array type | |
# from /usr/lib/ruby/1.8/irb.rb:302:in `to_s' | |
# from /usr/lib/ruby/1.8/irb.rb:302:in `inspect' | |
# from /usr/lib/ruby/1.8/irb.rb:302:in `output_value' | |
# from /usr/lib/ruby/1.8/irb.rb:151:in `eval_input' | |
# from /usr/lib/ruby/1.8/irb.rb:263:in `signal_status' | |
# from /usr/lib/ruby/1.8/irb.rb:147:in `eval_input' | |
# from /usr/lib/ruby/1.8/irb/ruby-lex.rb:244:in `each_top_level_statement' | |
# from /usr/lib/ruby/1.8/irb/ruby-lex.rb:230:in `loop' | |
# from /usr/lib/ruby/1.8/irb/ruby-lex.rb:230:in `each_top_level_statement' | |
# from /usr/lib/ruby/1.8/irb/ruby-lex.rb:229:in `catch' | |
# from /usr/lib/ruby/1.8/irb/ruby-lex.rb:229:in `each_top_level_statement' | |
# from /usr/lib/ruby/1.8/irb.rb:146:in `eval_input' | |
# from /usr/lib/ruby/1.8/irb.rb:70:in `start' | |
# from /usr/lib/ruby/1.8/irb.rb:69:in `catch' | |
# from /usr/lib/ruby/1.8/irb.rb:69:in `start' | |
# from /usr/bin/irb:13 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment