# ffi/ffi

Ruby FFI

Repository: https://github.com/ffi/ffi
Canonical: https://ross.abutalabs.com/products/ffi
Homepage: https://github.com/ffi/ffi/wiki
Language: Ruby
License: BSD-3-Clause
License Family: permissive
Last push: 2026-07-09T18:56:24+00:00

## Health v2 (maintenance only)
Score: 73/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 91, release rhythm 35, longevity 100
- inputs: {"age_days": 6237, "days_push": 55, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2129, forks 346 (observed 2026-08-28T04:06:17.070075+00:00)

## What it is
Ruby-FFI is a Ruby gem for programmatically loading dynamically-linked native libraries, binding their functions, and calling them from Ruby code. It provides an intuitive DSL supporting C types, structs, enums, callbacks, and works unchanged across CRuby, JRuby, Rubinius, and TruffleRuby.

## Use cases
- call C library functions from Ruby
- load a shared native library and bind its functions
- write Ruby extensions without C code
- pass structs and callbacks between Ruby and C
- use the Windows API from Ruby
- wrap a native C library for a Ruby gem

## When to choose
- you need to call native C libraries from Ruby without writing C extension code
- you want one extension codebase that works on MRI, JRuby, and TruffleRuby
- you need callbacks, structs, enums, or pointers interop with C
- you want automatic garbage collection of native memory

## When to avoid
- you need maximum performance from a hand-tuned native extension
- you only target MRI and prefer native C extensions with direct Ruby API access
- you need to bind C++ classes rather than C functions

## Facets
- artifact type: library
- maturity: stable
- function: sdk, developer-tools
- domain: developer-tools, programming-languages, cross-platform
- platform: ruby, windows, cross-platform
- tags: ffi, foreign-function-interface, native-libraries, libffi, ruby-gem, c-bindings, jruby, truffleruby, linux, macos

## Member repositories
- ffi/ffi (main) score 73

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:17.070075+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:52:24.742457+00:00, confidence not recorded.
  - readme: https://github.com/ffi/ffi (fetched 2026-08-28T04:06:17.070075+00:00, sha 8cc16fef991f)
  - homepage: https://github.com/ffi/ffi/wiki (fetched 2026-08-29T10:32:14.674576+00:00, sha de756339d510)
- Data as of 2026-08-30T08:39:29.467469+00:00.
