A summary of data about the Ruby ecosystem.

https://github.com/ffi/ffi

Ruby FFI
https://github.com/ffi/ffi

Keywords from Contributors

rubygems activerecord mvc activejob rack ruby-gem nokogiri json-parser rspec libxml2

Last synced: about 22 hours ago
JSON representation

Repository metadata

Ruby FFI

README.md

Ruby-FFI https://github.com/ffi/ffi/wiki

Description

Ruby-FFI is a gem for programmatically loading dynamically-linked native
libraries, binding functions within them, and calling those functions
from Ruby code. Moreover, a Ruby-FFI extension works without changes
on CRuby (MRI), JRuby, Rubinius and TruffleRuby. Discover why you should write your next extension
using Ruby-FFI
.

Features

  • 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
  • Usable in Ractor: How-to-use-FFI-in-Ruby-Ractors

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 examples you may look at:

Requirements

When installing the gem on CRuby (MRI), you will need:

  • A C compiler (e.g., Xcode on macOS, gcc or clang on everything else)
    Optionally (speeds up installation):
  • The libffi library and development headers - this is commonly in the libffi-dev or libffi-devel packages

The ffi gem comes with a builtin libffi version, which is used, when the system libffi library is not available or too old.
Use of the system libffi can be enforced by:

gem install ffi -- --enable-system-libffi        # to install the gem manually
bundle config build.ffi --enable-system-libffi   # for bundle install

or prevented by --disable-system-libffi.

On Linux systems running with PaX (Gentoo, Alpine, etc.), FFI may trigger mprotect errors. You may need to disable mprotect for ruby (paxctl -m [/path/to/ruby]) for the time being until a solution is found.

On FreeBSD systems pkgconf must be installed for the gem to be able to compile using clang. Install either via packages pkg install pkgconf or from ports via devel/pkgconf.

On JRuby and TruffleRuby, there are no requirements to install the FFI gem, and require 'ffi' works even without installing the gem (i.e., the gem is preinstalled on these implementations).

Installation

From rubygems:

[sudo] gem install ffi

From a Gemfile using git or GitHub

gem 'ffi', github: 'ffi/ffi', submodules: true

or from the git repository on github:

git clone git://github.com/ffi/ffi.git
cd ffi
git submodule update --init --recursive
bundle install
rake install

Install options:

  • --enable-system-libffi : Force usage of system libffi
  • --disable-system-libffi : Force usage of builtin libffi
  • --enable-libffi-alloc : Force closure allocation by libffi
  • --disable-libffi-alloc : Force closure allocation by builtin method

License

The ffi library is covered by the BSD license, also see the LICENSE file.
The specs are covered by the same license as ruby/spec, the MIT license.

Credits

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


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 8 days ago

Total Commits: 2,112
Total Committers: 162
Avg Commits per committer: 13.037
Development Distribution Score (DDS): 0.519

Commits in past year: 34
Committers in past year: 8
Avg Commits per committer in past year: 4.25
Development Distribution Score (DDS) in past year: 0.471

Name Email Commits
Wayne Meissner w****r@g****m 1016
Lars Kanis l****s@g****e 412
Benoit Daloze e****p@g****m 91
tduehr t****r@g****m 81
Andrea Fazzi a****i@a****t 61
ParadoxV5 p****5@g****m 30
wmeissner d****l@l****t 28
Kim Burgestrand k****m@b****e 22
Jean Boussier j****r@g****m 19
Antonio Terceiro t****o@s****g 16
Charlie Savage c****s@z****m 15
Charles Oliver Nutter h****s@h****m 15
Matijs van Zuijlen m****s@m****t 14
Charlie Savage c****s@s****m 12
Olle Jonsson o****n@a****m 11
Luc Heinrich l****c@h****m 10
Mike Dalessio m****o@g****m 8
Stan Hu s****u@g****m 7
pavel p****y@e****z 7
Sylvain Daubert s****t@l****t 7
wycats@gmail.com w****s@g****m 7
Paul Kunysch k****h@m****m 6
Brice Videau b****u@a****v 6
Ivo Anjo i****o@d****m 6
Postmodern p****3@g****m 5
Chris Seaton c****n@s****m 5
Andrew Neitsch a****w@n****a 5
Watson w****8@g****m 4
Thomas E. Enebo t****o@g****m 4
Kevin Menard k****n@n****m 4
and 132 more...

Committer domains:


Issue and Pull Request metadata

Last synced: 17 days ago

Total issues: 122
Total pull requests: 187
Average time to close issues: 3 months
Average time to close pull requests: 3 months
Total issue authors: 98
Total pull request authors: 54
Average comments per issue: 5.11
Average comments per pull request: 1.8
Merged pull request: 128
Bot issues: 0
Bot pull requests: 0

Past year issues: 18
Past year pull requests: 33
Past year average time to close issues: about 15 hours
Past year average time to close pull requests: 19 days
Past year issue authors: 15
Past year pull request authors: 10
Past year average comments per issue: 0.56
Past year average comments per pull request: 1.73
Past year merged pull request: 22
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/ffi/ffi

Top Issue Authors

  • ParadoxV5 (8)
  • eregon (4)
  • JasonLunn (3)
  • mensfeld (3)
  • rgaufman (3)
  • larskanis (3)
  • slithernix (2)
  • howellbrett98-bot (2)
  • itspomf (2)
  • uvlad7 (2)
  • tagliala (2)
  • johnmccrae (2)
  • muescha (1)
  • chrisgeek (1)
  • lloeki (1)

Top Pull Request Authors

  • larskanis (70)
  • casperisfine (20)
  • stanhu (6)
  • eregon (5)
  • cfis (5)
  • postmodern (5)
  • voxik (4)
  • KJTsanaktsidis (4)
  • johnnyshields (4)
  • orgads (4)
  • ParadoxV5 (4)
  • lloeki (2)
  • y9v (2)
  • olleolleolle (2)
  • paholg (2)

Top Issue Labels

  • bug (1)

Top Pull Request Labels

  • enhancement (1)

Package metadata

gem.coop: ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi/wiki
  • Documentation: http://www.rubydoc.info/gems/ffi/
  • Licenses: BSD-3-Clause
  • Latest release: 1.17.2 (published 8 months ago)
  • Last Synced: 2025-12-09T03:02:05.352Z (1 day ago)
  • Versions: 406
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 941,441,478 Total
  • Docker Downloads: 3,778,731,413
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.007%
    • Docker downloads count: 0.013%
    • Downloads: 0.015%
  • Maintainers (4)
rubygems.org: ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi/wiki
  • Documentation: http://www.rubydoc.info/gems/ffi/
  • Licenses: BSD-3-Clause
  • Latest release: 1.17.2 (published 8 months ago)
  • Last Synced: 2025-12-09T00:02:22.277Z (2 days ago)
  • Versions: 407
  • Dependent Packages: 1,098
  • Dependent Repositories: 983,191
  • Downloads: 941,392,380 Total
  • Docker Downloads: 3,778,731,413
  • Rankings:
    • Dependent repos count: 0.006%
    • Downloads: 0.016%
    • Docker downloads count: 0.026%
    • Dependent packages count: 0.045%
    • Average: 0.45%
    • Stargazers count: 1.115%
    • Forks count: 1.492%
  • Maintainers (4)
  • Advisories:
alpine-v3.18: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD-3-Clause
  • Latest release: 1.15.5-r2 (published over 2 years ago)
  • Last Synced: 2025-12-07T21:02:45.143Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 2.491%
    • Forks count: 4.573%
    • Stargazers count: 5.391%
  • Maintainers (1)
alpine-v3.15: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD-3-Clause
  • Latest release: 1.15.5-r0 (published almost 4 years ago)
  • Last Synced: 2025-12-01T09:42:46.551Z (9 days ago)
  • Versions: 1
  • Dependent Packages: 3
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Forks count: 3.519%
    • Stargazers count: 3.878%
    • Average: 3.899%
    • Dependent packages count: 8.198%
  • Maintainers (1)
alpine-edge: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD-3-Clause
  • Latest release: 1.17.2-r0 (published 8 months ago)
  • Last Synced: 2025-12-07T21:02:53.029Z (3 days ago)
  • Versions: 9
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Average: 4.301%
    • Stargazers count: 5.483%
    • Forks count: 5.69%
    • Dependent packages count: 6.031%
  • Maintainers (1)
alpine-v3.8: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD
  • Latest release: 1.9.25-r0 (published over 7 years ago)
  • Last Synced: 2025-12-07T21:02:27.140Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Stargazers count: 2.653%
    • Forks count: 2.852%
    • Average: 5.599%
    • Dependent packages count: 16.89%
  • Maintainers (1)
alpine-v3.16: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD-3-Clause
  • Latest release: 1.15.5-r1 (published over 3 years ago)
  • Last Synced: 2025-12-07T21:02:35.364Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Forks count: 3.604%
    • Stargazers count: 4.156%
    • Average: 6.606%
    • Dependent packages count: 18.665%
  • Maintainers (1)
alpine-v3.13: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD-3-Clause
  • Latest release: 1.13.1-r0 (published over 5 years ago)
  • Last Synced: 2025-12-07T21:02:36.728Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Forks count: 3.497%
    • Stargazers count: 3.519%
    • Average: 6.635%
    • Dependent packages count: 19.522%
  • Maintainers (1)
alpine-v3.10: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD-3-Clause
  • Latest release: 1.10.0-r1 (published over 6 years ago)
  • Last Synced: 2025-12-07T21:02:35.587Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Stargazers count: 2.853%
    • Forks count: 3.095%
    • Average: 6.852%
    • Dependent packages count: 21.46%
  • Maintainers (1)
alpine-v3.12: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD-3-Clause
  • Latest release: 1.12.2-r2 (published over 5 years ago)
  • Last Synced: 2025-12-02T10:13:30.586Z (8 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Stargazers count: 3.103%
    • Forks count: 3.205%
    • Average: 6.944%
    • Dependent packages count: 21.468%
  • Maintainers (1)
alpine-v3.7: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD
  • Latest release: 1.9.18-r0 (published about 8 years ago)
  • Last Synced: 2025-12-07T21:02:27.750Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 4
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Stargazers count: 2.37%
    • Forks count: 2.614%
    • Average: 7.092%
    • Dependent packages count: 23.383%
  • Maintainers (1)
alpine-v3.17: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD-3-Clause
  • Latest release: 1.15.5-r1 (published over 3 years ago)
  • Last Synced: 2025-12-07T21:02:40.067Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Forks count: 4.154%
    • Stargazers count: 5.456%
    • Average: 7.14%
    • Dependent packages count: 18.951%
  • Maintainers (1)
alpine-v3.14: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD-3-Clause
  • Latest release: 1.15.3-r0 (published over 4 years ago)
  • Last Synced: 2025-12-07T21:02:39.836Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Forks count: 3.43%
    • Stargazers count: 3.603%
    • Average: 7.178%
    • Dependent packages count: 21.681%
  • Maintainers (1)
alpine-v3.9: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD
  • Latest release: 1.9.25-r0 (published almost 7 years ago)
  • Last Synced: 2025-12-07T21:02:35.389Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Stargazers count: 2.78%
    • Forks count: 3.067%
    • Average: 7.249%
    • Dependent packages count: 23.151%
  • Maintainers (1)
alpine-v3.11: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD-3-Clause
  • Latest release: 1.11.3-r0 (published about 6 years ago)
  • Last Synced: 2025-12-07T21:02:38.246Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Forks count: 3.273%
    • Stargazers count: 3.282%
    • Average: 7.289%
    • Dependent packages count: 22.601%
  • Maintainers (1)
proxy.golang.org: github.com/ffi/ffi

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/ffi/ffi#section-documentation
  • Licenses: bsd-3-clause
  • Latest release: v1.17.2 (published 8 months ago)
  • Last Synced: 2025-12-07T21:02:30.386Z (3 days ago)
  • Versions: 14
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent packages count: 6.999%
    • Average: 8.173%
    • Dependent repos count: 9.346%
conda-forge.org: rb-ffi

  • Homepage: https://rubygems.org/gems/ffi
  • Licenses: BSD-3-Clause
  • Latest release: 1.11.1 (published almost 4 years ago)
  • Last Synced: 2025-12-01T10:06:35.062Z (9 days ago)
  • Versions: 1
  • Dependent Packages: 3
  • Dependent Repositories: 1
  • Rankings:
    • Stargazers count: 8.884%
    • Forks count: 9.299%
    • Average: 14.47%
    • Dependent packages count: 15.618%
    • Dependent repos count: 24.078%
alpine-v3.22: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD-3-Clause
  • Latest release: 1.17.2-r0 (published 8 months ago)
  • Last Synced: 2025-12-07T21:02:42.964Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
  • Maintainers (1)
alpine-v3.19: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD-3-Clause
  • Latest release: 1.16.3-r0 (published about 2 years ago)
  • Last Synced: 2025-12-07T21:02:43.469Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
  • Maintainers (1)
alpine-v3.21: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD-3-Clause
  • Latest release: 1.17.0-r0 (published about 1 year ago)
  • Last Synced: 2025-12-07T21:03:03.574Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
  • Maintainers (1)
alpine-v3.20: ruby-ffi

Ruby FFI library

  • Homepage: https://github.com/ffi/ffi
  • Licenses: BSD-3-Clause
  • Latest release: 1.16.3-r1 (published almost 2 years ago)
  • Last Synced: 2025-12-07T21:03:00.092Z (3 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
  • Maintainers (1)

Dependencies

Gemfile rubygems
  • bundler >= 1.16, < 3 development
  • kramdown >= 0 development
  • rake ~> 13.0 development
  • rake-compiler ~> 1.1 development
  • rake-compiler-dock ~> 1.0 development
  • rspec ~> 3.0 development
  • yard ~> 0.9 development
ffi.gemspec rubygems
  • rake ~> 13.0 development
  • rake-compiler ~> 1.1 development
  • rake-compiler-dock ~> 1.0 development
  • rspec ~> 2.14.1 development
.github/workflows/ci.yml actions
  • actions/checkout v2 composite
  • ruby/setup-ruby v1 composite

Score: 35.782167420417906