Skip to content

Instantly share code, notes, and snippets.

@saranyan
Created January 31, 2012 14:03
Show Gist options
  • Save saranyan/1710638 to your computer and use it in GitHub Desktop.
Save saranyan/1710638 to your computer and use it in GitHub Desktop.
Testing Ruby FFI - Ruby Wrapper
# mylibrary.rb
TESTVAR = 2
module MyLibrary
extend FFI::Library
ffi_lib "mylibrary.so"
attach_function :calculate_something, [:int, :float], :double
attach_function :test_function_1, [:string], :string
attach_function :test_function_2, [:double, :pointer, :string], :int
attach_function :test_function_3, [], :void
attach_function :test_function_4, [:pointer], :void
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment