Skip to content
A libffi wrapper for Ruby.
Branch: master
Clone or download
Latest commit ea06b28 Jun 13, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Track downloader scripts from ruby core repository. Jul 13, 2017
ext/fiddle Fiddle::Function must maintain a reference to the closure Jan 10, 2019
lib fiddle/import.rb: suppress warning Aug 6, 2018
test Use RbConfig::SIZEOF (#19) Jun 13, 2019
.gitignore Ignore libffi Apr 7, 2017
.travis.yml travis: remove needless configurations May 27, 2019
Gemfile Added boilerplate of fiddle gem used `bundle init fiddle` Apr 5, 2017
LICENSE.txt Modified license to BSD-2-Clause Apr 10, 2017 README: Add ruby code fences [ci skip] Dec 25, 2017
Rakefile Added dependency for default task Apr 11, 2017


Build Status

A libffi wrapper for Ruby.

Fiddle is an extension to translate a foreign function interface (FFI) with ruby.

It wraps libffi, a popular C library which provides a portable interface that allows code written in one language to call code written in another language.


Add this line to your application's Gemfile:

gem 'fiddle'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fiddle


Here we will use Fiddle::Function to wrap floor(3) from libm

require 'fiddle'

libm = Fiddle.dlopen('/lib/')

floor =

puts #=> 3.0


After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to


Bug reports and pull requests are welcome on GitHub at


The gem is available as open source under the terms of the BSD-2-Clause.

You can’t perform that action at this time.