Created
February 16, 2009 12:48
-
-
Save jmettraux/65150 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
| require 'rubygems' | |
| require 'ffi' | |
| module Hello | |
| extend FFI::Library | |
| attach_function 'puts', [ :string ], :int | |
| end | |
| Hello.puts("1") | |
| Hello.puts(1) | |
| # jmettraux:~/tmp/ffi$ ruby auto_string.rb | |
| # 1 | |
| # (eval):3:in `call1': Invalid String value (ArgumentError) | |
| # from (eval):3:in `puts' | |
| # from auto_string.rb:12 | |
| # jmettraux:~/tmp/ffi$ ruby19 auto_string.rb | |
| # 1 | |
| # (eval):3:in `call1': Invalid String value (ArgumentError) | |
| # from (eval):3:in `puts' | |
| # from auto_string.rb:12:in `<main>' | |
| # jmettraux:~/tmp/ffi$ jruby-1.1.6 auto_string.rb | |
| # 1 | |
| # 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment