Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. require 'ffi'
  2.  
  3. module Scrape
  4. extend FFI::Library
  5. ffi_lib './target/debug/libscrape.dylib'
  6.  
  7. class TwoNumbers < FFI::Struct
  8. layout :first, :int32,
  9. :second, :int32
  10. end
  11.  
  12. attach_function :add_struct_vals, [TwoNumbers.by_value], :int32
  13. end
  14.  
  15. tn = Scrape::TwoNumbers.new
  16. tn[:first] = 10
  17. tn[:second] = 20
  18.  
  19. puts Scrape.add_struct_vals(tn) == 30 ? "Gone Dun It!" : "Uhhhh????"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement