Skip to content

Instantly share code, notes, and snippets.

@aj07
Created June 20, 2015 13:50
Show Gist options
  • Save aj07/7b6247d588371745e067 to your computer and use it in GitHub Desktop.
Save aj07/7b6247d588371745e067 to your computer and use it in GitHub Desktop.
module MyLibrary
extend FFI::Library
ffi_lib "./mylibrary.so"
attach_function :createLight, [],:pointer
attach_function :destroyLight, [:pointer], :void
attach_function :toggleLight, [:pointer], :void
attach_function :declareLight, [:pointer], :void
@aj07
Copy link
Author

aj07 commented Jun 20, 2015

require 'ffi'

module MyLib
extend FFI::Library
ffi_lib 'c'
attach_function :puts, [ :string ], :int
end

MyLib.puts 'Hello, World using libc!'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment