Created
June 22, 2015 17:47
-
-
Save aj07/4b2a791ee42578b82631 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MyLibrary | |
extend FFI::Library | |
ffi_lib "./addressbook.so" | |
attach_function :writeAddressbook, | |
[], :pointer | |
attach_function :readAddressbook, [], [:pointer],:void | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ffi' | |
require 'addressbook' | |
Alice = AddressBook.write_address_book(); | |
AddressBook.read_Id( Alice ); | |
AddressBook.read_name( Alice ); | |
AddressBook.read_email( Alice ); | |
AddressBook.read_phone.on(Alice); | |
AddressBook.read_phone.type(Alice); | |
AddressBook.read_employmentschool(Alice); | |
Bob = AddressBook.write_address_book(); | |
AddressBook.read_Id( Bob ); | |
AddressBook.read_name( Bob ); | |
AddressBook.read_email( Bob ); | |
AddressBook.read_phone.on(Bob); | |
AddressBook.read_phone.type(Bob); | |
AddressBook.read_employmentschool(Bob); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ls: cannot access ?pp: No such file or directory
rm: missing operand
Try 'rm --help' for more information.
ls: cannot access *?pp: No such file or directory
Testing ...
/usr/lib/jruby//lib/ruby/site_ruby/shared/ffi/library.rb:28:in
ffi_lib': Could not open library './addressbook.so' : ./addressbook.so: cannot open shared object file: No such file or directory (LoadError) from /usr/lib/jruby//lib/ruby/site_ruby/shared/ffi/library.rb:10:in
map'from /usr/lib/jruby//lib/ruby/site_ruby/shared/ffi/library.rb:10:in
ffi_lib' from ./addressbook.rb:3 from ./addressbook.rb:3:in
require'from myapp.rb:3
make: ** [main] Error 1