[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8039":3},{"id":4,"name":5,"fullName":6,"owner":5,"repo":5,"description":7,"homepage":8,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":17,"rankGlobal":9,"rankLanguage":9,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":9,"pushedAt":9,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":15,"starSnapshotCount":15,"syncStatus":26,"lastSyncTime":27,"discoverSource":28},8039,"ffi","ffi\u002Fffi","Ruby FFI","https:\u002F\u002Fgithub.com\u002Fffi\u002Fffi\u002Fwiki",null,"Ruby",2131,344,40,129,0,14,29.61,"BSD 3-Clause \"New\" or \"Revised\" License",false,"master",true,[],"2026-06-12 02:01:48","# Ruby-FFI https:\u002F\u002Fgithub.com\u002Fffi\u002Fffi\u002Fwiki\n\n## Description\n\nRuby-FFI is a gem for programmatically loading dynamically-linked native\nlibraries, binding functions within them, and calling those functions\nfrom Ruby code. Moreover, a Ruby-FFI extension works without changes\non CRuby (MRI), JRuby, Rubinius and TruffleRuby. [Discover why you should write your next extension\nusing Ruby-FFI](https:\u002F\u002Fgithub.com\u002Fffi\u002Fffi\u002Fwiki\u002Fwhy-use-ffi).\n\n## Features\n\n* Intuitive DSL\n* Supports all C native types\n* C structs (also nested), enums and global variables\n* Callbacks from C to Ruby\n* Automatic garbage collection of native memory\n* Usable in Ractor: [How-to-use-FFI-in-Ruby-Ractors](https:\u002F\u002Fgithub.com\u002Fffi\u002Fffi\u002Fwiki\u002FRactors)\n\n## Synopsis\n\n```ruby\nrequire 'ffi'\n\nmodule MyLib\n  extend FFI::Library\n  ffi_lib 'c'\n  attach_function :puts, [ :string ], :int\nend\n\nMyLib.puts 'Hello, World using libc!'\n```\n\nFor less minimalistic and more examples you may look at:\n\n* The [documentation](https:\u002F\u002Fwww.rubydoc.info\u002Fgems\u002Fffi)\n* the `samples\u002F` folder\n* the examples on the [wiki](https:\u002F\u002Fgithub.com\u002Fffi\u002Fffi\u002Fwiki)\n* the projects using FFI listed on the wiki: https:\u002F\u002Fgithub.com\u002Fffi\u002Fffi\u002Fwiki\u002Fprojects-using-ffi\n\n## Requirements\n\nWhen installing the gem on CRuby (MRI), you will need:\n* A C compiler (e.g., Xcode on macOS, `gcc` or `clang` on everything else)\nOptionally (speeds up installation):\n* The `libffi` library and development headers - this is commonly in the `libffi-dev` or `libffi-devel` packages\n\nThe ffi gem comes with a builtin libffi version, which is used, when the system libffi library is not available or too old.\nUse of the system libffi can be enforced by:\n```\ngem install ffi -- --enable-system-libffi        # to install the gem manually\nbundle config build.ffi --enable-system-libffi   # for bundle install\n```\nor prevented by `--disable-system-libffi`.\n\nOn Linux systems running with [PaX](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FPaX) (Gentoo, Alpine, etc.), FFI may trigger `mprotect` errors. You may need to disable [mprotect](https:\u002F\u002Fen.wikibooks.org\u002Fwiki\u002FGrsecurity\u002FAppendix\u002FGrsecurity_and_PaX_Configuration_Options#Restrict_mprotect.28.29) for ruby (`paxctl -m [\u002Fpath\u002Fto\u002Fruby]`) for the time being until a solution is found.\n\nOn 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\u002Fpkgconf`.\n\nOn 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).\n\n## Installation\n\nFrom rubygems:\n\n    [sudo] gem install ffi\n\nFrom a Gemfile using git or GitHub\n\n    gem 'ffi', github: 'ffi\u002Fffi', submodules: true\n\nor from the git repository on github:\n\n    git clone git:\u002F\u002Fgithub.com\u002Fffi\u002Fffi.git\n    cd ffi\n    git submodule update --init --recursive\n    bundle install\n    rake install\n\n### Install options:\n\n* `--enable-system-libffi` : Force usage of system libffi\n* `--disable-system-libffi` : Force usage of builtin libffi\n* `--enable-libffi-alloc` : Force closure allocation by libffi\n* `--disable-libffi-alloc` : Force closure allocation by builtin method\n\n## License\n\nThe ffi library is covered by the BSD license, also see the LICENSE file.\nThe specs are covered by the same license as [ruby\u002Fspec](https:\u002F\u002Fgithub.com\u002Fruby\u002Fspec), the MIT license.\n\n## Credits\n\nThe following people have submitted code, bug reports, or otherwise contributed to the success of this project:\n\n* Alban Peignier \u003Calban.peignier@free.fr>\n* Aman Gupta \u003Caman@tmm1.net>\n* Andrea Fazzi \u003Candrea.fazzi@alcacoop.it>\n* Andreas Niederl \u003Crico32@gmx.net>\n* Andrew Cholakian \u003Candrew@andrewvc.com>\n* Antonio Terceiro \u003Cterceiro@softwarelivre.org>\n* Benoit Daloze \u003Ceregontp@gmail.com>\n* Brian Candler \u003CB.Candler@pobox.com>\n* Brian D. Burns \u003Cburns180@gmail.com>\n* Bryan Kearney \u003Cbkearney@redhat.com>\n* Charlie Savage \u003Ccfis@zerista.com>\n* Chikanaga Tomoyuki \u003Cnagachika00@gmail.com>\n* Hongli Lai \u003Chongli@phusion.nl>\n* Ian MacLeod \u003Cian@nevir.net>\n* Jake Douglas \u003Cjake@shiftedlabs.com>\n* Jean-Dominique Morani \u003Cjdmorani@mac.com>\n* Jeremy Hinegardner \u003Cjeremy@hinegardner.org>\n* Jesús García Sáez \u003Cblaxter@gmail.com>\n* Joe Khoobyar \u003Cjoe@ankhcraft.com>\n* Jurij Smakov \u003Cjurij@wooyd.org>\n* KISHIMOTO, Makoto \u003Cksmakoto@dd.iij4u.or.jp>\n* Kim Burgestrand \u003Ckim@burgestrand.se>\n* Lars Kanis \u003Clars@greiz-reinsdorf.de>\n* Luc Heinrich \u003Cluc@honk-honk.com>\n* Luis Lavena \u003Cluislavena@gmail.com>\n* Matijs van Zuijlen \u003Cmatijs@matijs.net>\n* Matthew King \u003Cautomatthew@gmail.com>\n* Mike Dalessio \u003Cmike.dalessio@gmail.com>\n* NARUSE, Yui \u003Cnaruse@airemix.jp>\n* Park Heesob \u003Cphasis@gmail.com>\n* Shin Yee \u003Cshinyee@speedgocomputing.com>\n* Stephen Bannasch \u003Cstephen.bannasch@gmail.com>\n* Suraj N. Kurapati \u003Csunaku@gmail.com>\n* Sylvain Daubert \u003Csylvain.daubert@laposte.net>\n* Victor Costan\n* beoran@gmail.com\n* ctide \u003Cchristide@christide.com>\n* emboss \u003CMartin.Bosslet@googlemail.com>\n* hobophobe \u003Cunusualtears@gmail.com>\n* meh \u003Cmeh@paranoici.org>\n* postmodern \u003Cpostmodern.mod3@gmail.com>\n* wycats@gmail.com \u003Cwycats@gmail.com>\n* Wayne Meissner \u003Cwmeissner@gmail.com>\n","Ruby-FFI 是一个用于从 Ruby 代码中加载动态链接库并调用其中函数的 gem。它提供了一个直观的 DSL，支持所有 C 语言原生类型、结构体（包括嵌套）、枚举和全局变量，并允许 C 代码回调到 Ruby 中。此外，Ruby-FFI 能够自动管理本地内存的垃圾回收，并且在 Ractor 环境下可用。该扩展无需修改即可跨 CRuby (MRI)、JRuby、Rubinius 和 TruffleRuby 平台工作。适用于需要与 C 库进行交互但又不想或不能直接编写 C 扩展的 Ruby 项目场景。",2,"2026-06-11 03:15:47","top_language"]