Hi, guys
I have the following code copied from the ruby-ffi github page. I have Xcode installed. tested both in ruby ruby-1.8.7-p352 [ i686 ] and ruby-1.9.2-p180 [ x86_64 ]
but got the error:
gems/ffi-1.0.11/lib/ffi/library.rb:121:in `block in ffi_lib': Could not open library 'c': dlopen(c, 5): image not found. (LoadError)
Could not open library 'libc.dylib': dlopen(libc.dylib, 5): image not found
the code:
require 'rubygems'
require 'ffi'
module MyLib
extend FFI::Library
ffi_lib 'c'
attach_function :puts, [ :string ], :int
end
MyLib.puts 'Hello boys using libc!'