| 1 |
#!/usr/bin/ruby |
| 2 |
|
| 3 |
# This is the most basic example of usage shown in upstream's README file. |
| 4 |
|
| 5 |
require 'ffi' |
| 6 |
|
| 7 |
module MyLib |
| 8 |
extend FFI::Library |
| 9 |
ffi_lib 'c' |
| 10 |
attach_function :puts, [ :string ], :int |
| 11 |
end |
| 12 |
|
| 13 |
MyLib.puts 'Hello, World using libc!' |