Creating C extensions in Ruby, *really* fast

by pat eyler

First, there were the threads about rewriting Ruby apps in C, then I wrote a pair of follow up posts (here and here). These got picked up by an article over on InfoQ, which also pointed to How to Create a Ruby Extension in 5 Minutes. Finally, zenspider picked that up, tried it out, and wrote about his take on RubyInline and extensions: Writing C Extensions, Improved.

The traditional way meant creating a 5 line mkmf generator, 7 lines of C, running through the two step build process to end up with a dynamic library that can be required by ruby programs. With RubyInline, it took 8 lines of Ruby and C that live inside the Ruby program itself — the best part is that their now user run configure and compile cycle. they just run the Ruby program, and RubyInline does the work.

To quote zenspider, "It doesn't get simpler than this... and really, it shouldn't ever be more difficult than this." Go take a look at the blog posts listed above, then go download RubyInline and make your life a whole lot easier.


Ervin J
2006-08-01 14:18:55
The correct link is Writing C Extensions, Improved.
2006-08-01 15:27:35
Ervin, thanks ... sometimes I hate cut-n-paste.
2006-08-02 07:56:12
They just run the Ruby program, and RubyInline does the work.