Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bench
Octocat-spinner-32 ext
Octocat-spinner-32 gen
Octocat-spinner-32 lib
Octocat-spinner-32 libtest
Octocat-spinner-32 nbproject
Octocat-spinner-32 samples
Octocat-spinner-32 spec
Octocat-spinner-32 .autotest
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .hgignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 .yardopts
Octocat-spinner-32 COPYING
Octocat-spinner-32 COPYING.LESSER
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 History.txt
Octocat-spinner-32 LICENSE
Octocat-spinner-32 LICENSE.SPECS
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 ffi.gemspec
README.md

ruby-ffi https://wiki.github.com/ffi/ffi Build Status

Description

Ruby-FFI is a ruby extension for programmatically loading dynamic libraries, binding functions within them, and calling those functions from Ruby code. Moreover, a Ruby-FFI extension works without changes on Ruby and JRuby. Discover why you should write your next extension using Ruby-FFI.

Features/problems

  • Intuitive DSL
  • Supports all C native types
  • C structs (also nested), enums and global variables
  • Callbacks from C to ruby
  • Automatic garbage collection of native memory

Synopsis

require 'ffi'

module MyLib
  extend FFI::Library
  ffi_lib 'c'
  attach_function :puts, [ :string ], :int
end

MyLib.puts 'Hello, World using libc!'

For less minimalistic and more sane examples you may look at:

Requirements

You need a sane building environment in order to compile the extension. At a minimum, you will need:

  • A C compiler (e.g. Xcode on OSX, gcc on everything else)
  • libffi development library - this is commonly in the libffi-dev or libffi-devel

Installation

From rubygems:

[sudo] gem install ffi

or from the git repository on github:

git clone git://github.com/ffi/ffi.git
cd ffi
rake gem:install

License

The ffi library is covered by the LGPL3 license, also see the LICENSE file. The specs are shared with Rubyspec and are licensed by the same license as Rubyspec, see the LICENSE.SPECS file.

Credits

The following people have submitted code, bug reports, or otherwide contributed to the success of this project:

Something went wrong with that request. Please try again.