c2ffi - FFI binding generator - for Ruby
gem install c2ffi4rbFirst, produce a spec file using c2ffi.
c2ffi -M macros.h -o example.json example.h
c2ffi -o macros.json example.h macros.hNext, use c2ffi4rb to generate ruby code.
c2ffi4rb example.json macros.json > simple.rbFinally, improve simple.rb manually to complete the binding.
c2ffi4rb -h # Show help
c2ffi4rb -v # Show version
c2ffi4rb -t table.tsv file.json macros.json > output.rb # Use type conversion tableTo run tests, install c2ffi, Cairo, and pkg-config in advance.
Then execute rake test.