Ruby-red onions: Peeling Back Ruby's Layers in C Extensions
summary
An actual C extension is written to add Kerberos authentication to the MongoDB Ruby driver, after segfaults with Ruby FFI force a native rewrite. Build tooling uses extconf.rb and rake-compiler to create Makefiles and tests, and packaging requires gemspec flags so RubyGems runs the compile step. A release is yanked when extconf aborts gem install on systems missing headers, so the extension moves to a separate gem and later records about 309 downloads.
AI-written summary · about
chapters (14)
- 0:00Intro
- 2:38Once upon a time
- 4:02Alternatives
- 5:16Finally wrote it.
- 6:32Let's answer
- 7:40ruby source code README.EXT
- 11:33Data types have corresponding C structures.
- 11:55Casting macros can be used to get a pointer to the struct.
- 15:10Encapsulate C data into a Ruby object
- 19:47rake compile task
- 20:26gemspec
- 21:57the C code
- 25:561 extconf.rb
- 27:26mongo_kerberos
related talks
15m"Ruby native extensions and what's wrong with them"
36mUsing Ruby In Security Critical Applications
35mRuby’s C Extension Problem and How We're Solving It
30mBuilding Native Extensions. This Could Take A While...
54mRuby Committers vs the World
48mRuby & You
29mIntroduction to CRuby source code
30mRelease Responsibly
