FFI (Foreign Function Invocation): Making Cross Engine Extensions
by Jeremy Hinegardner
He Loves Ruby and C. This talk is about Ruby extension development.
FFI is a way for something in one language to call functions in another
language. It’s great because FFI works between JRuby and libsomething.so, or
between Matz Ruby and libsomething.so, etc. FFI reduces the amount of code you
have to write to bridge between Ruby and C. I wonder how it compares with
Java’s Java Native Access. Are they complimentary (for JRuby)?
There’s an FFI generator that takes C header files and generates FFI code for you.
FFI saves developer time. It’s not as fast as a traditional C extension. When
you need to support JRuby or Rubiniess, then it saves even more developer
time.
How many gems are there that use or depend on FFI? Four. ffi-ncurses,
ffi-swig-generator, tidy_ffi, ffi-zlib. There’s another one for Open GL.
How many gems are there with extensions? 346