{"id":77823,"library":"ffi","title":"FFI","description":"Ruby FFI library provides a way to dynamically load and call native C functions from Ruby using a foreign function interface.","status":"active","version":"1.17.4","language":"ruby","source_language":null,"source_url":"https://github.com/ffi/ffi","tags":["ffi","native","c","binding","foreign-function"],"install":[{"cmd":"gem install ffi","lang":"bash","label":"gem install"},{"cmd":"# Gemfile\ngem 'ffi', '~> 1.17.4'","lang":"ruby","label":"Gemfile"}],"dependencies":[],"imports":[{"symbol":"FFI","correct":"require 'ffi'"}],"quickstart":{"code":"require 'ffi'\n\nmodule MyLib\n  extend FFI::Library\n  ffi_lib 'c'\n  attach_function :puts, [:string], :int\nend\n\nMyLib.puts('Hello from C!')","lang":"ruby","description":"Attach the C puts function and call it from Ruby."},"warnings":[{"fix":"Use FFI::MemoryPointer and manage memory carefully; test thoroughly.","message":"FFI can cause segmentation faults if memory is mismanaged; ensure proper type declarations.","severity":"gotcha","affected_versions":">= 0.0.0"}],"env_vars":null,"search_vec":"'bind':26 'c':14,25 'call':12 'dynam':9 'ffi':1,3,23 'foreign':20,28 'foreign-funct':27 'function':15,21,29 'interfac':22 'librari':4 'load':10 'nativ':13,24 'provid':5 'rubi':2,17 'use':18 'way':7","created_at":"2026-06-18T03:59:12.461856+00:00","updated_at":"2026-06-18T03:59:12.461856+00:00","problems":[],"ecosystem":"rubygems","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/ffi/ffi/wiki","github":"https://github.com/ffi/ffi","docs":"http://www.rubydoc.info/gems/ffi/","changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["utility","other"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-12-15","install_tag":null}}