stevefolder/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/samples/hello.rb

9 lines
197 B
Ruby
Raw Normal View History

2022-02-04 18:48:09 -05:00
require 'ffi'
module Foo
extend FFI::Library
ffi_lib FFI::Library::LIBC
attach_function("cputs", "puts", [ :string ], :int)
end
Foo.cputs("Hello, World via libc puts using FFI on MRI ruby")