# FFI madness! Rubygame 2.6, Ruby-SDL-FFI 0.1, and Nice-FFI 0.2 released

**URL:** <https://www.ruby-forum.com/t/ffi-madness-rubygame-2-6-ruby-sdl-ffi-0-1-and-nice-ffi-0-2-released/177864>\
**Category:** Ruby\
**Created:** [October 25, 2009, 9:39pm UTC](https://www.ruby-forum.com/t/ffi-madness-rubygame-2-6-ruby-sdl-ffi-0-1-and-nice-ffi-0-2-released/177864 "2009-10-25T21:39:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amin1426](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@amin1426](https://www.ruby-forum.com/u/amin1426)\
**Post date:** [October 25, 2009, 9:39pm UTC](https://www.ruby-forum.com/t/ffi-madness-rubygame-2-6-ruby-sdl-ffi-0-1-and-nice-ffi-0-2-released/177864/1 "2009-10-25T21:39:10Z")

</div>

It’s FFI madness! That’s foreign function interface, i.e. accessing  
compiled C libraries directly from Ruby. I’ve got three library  
releases to announce, all of them filled with FFI awesomeness.

First up is Rubygame 2.6, which throws away the old compiled C  
wrapper, instead using FFI to load SDL and related libraries. This is  
the easiest to install and most portable version of Rubygame ever,  
especially for Windows users. It’s also the first version of Rubygame  
to run on JRuby in addition to MatzRuby.

Next is Ruby-SDL-FFI 0.1, which provides FFI interfaces to SDL,  
SDL\_image, SDL\_gfx, SDL\_mixer, and SDL\_ttf. Ruby-SDL-FFI is similar in  
scope to the venerable Ruby/SDL library, but is not a drop-in  
replacement (the APIs are different, Ruby-SDL-FFI’s is more of a  
direct mirror of the SDL C interface). Ruby-SDL-FFI is still in an  
early formative stage, and hasn’t been thoroughly tested, so use with  
caution. Like Rubygame 2.6, this library works on both MatzRuby and  
JRuby, and any Ruby implementation with a compatible FFI API.

Finally, there is Nice-FFI 0.2, a helper library that makes developing  
FFI-based Ruby libraries even more convenient. Some of the nice things  
it offers are: easy creation of new struct instances from an array or  
hash of values, from a raw byte string, or wrapping an existing  
pointer; easy wrapping of struct pointers returned from functions; a  
smart memory management system for structs; hidden and read-only  
struct members; advanced pathset system for finding and loading  
libraries on many platforms; and more! Nice-FFI is more stable and  
well-tested than Ruby-SDL-FFI, but it’s still in early stages. It  
works with both Ruby-FFI and JRuby’s FFI.

Install instructions and download links are available at the Rubygame  
blog:

[http://blog.rubygame.org/articles/2009/10/24/rubygame-2-6-released](http://blog.rubygame.org/articles/2009/10/24/rubygame-2-6-released)

You can ask questions and get help in the Rubygame forums:

[http://rubygame.org/forums/](http://rubygame.org/forums/)

Enjoy!

- John

P.S. Many thanks to the people working on Ruby-FFI and JRuby for  
making it so easy. I can wholeheartedly recommend that any developer  
working on a compiled C wrapper should try FFI instead.
