Rice 1.4.0

Rice: Ruby Interface for C++ Extensions

What is Rice?

Rice is a C++ interface to Ruby’s C API. It provides a type-safe and
exception-safe interface in order to make embedding Ruby and writing
Ruby extensions with C++ easier. It is similar to Boost.Python in many
ways, but also attempts to provide an object-oriented interface to all
of the Ruby C API.

What’s New?

  • Fully compatible with Ruby 1.9.2
  • Constructor now supports default arguments
  • Ability to define implicit casting rules through
  • Various tweaks, bug fixes, and memory management updates

Supported Platforms:

  • Linux

  • Mac OS X 10.5 and 10.6

  • While Windows has been known to work with MinGW / MSYS, I haven’t
    been able to keep this testing up as of late. Would appreciate any

What Rice gives you:

  • A simple C+±based syntax for wrapping and defining classes
  • Automatic conversion of exceptions between C++ and Ruby
  • Smart pointers for handling garbage collection
  • Wrappers for most builtin types to simplify calling code

Documentation: http://rice.rubyforge.org

Project Page: GitHub - jameskilton/rice: Account name changed!

Mailing List: [email protected]
First email will be used as subscription and dropped.

How do you get Rice?

gem install rice

Note: Rice does require a C++ compiler. See the Documentation page for
more details.

How simple of a syntax?


#include <rice/Class.hpp>
#include <rice/Constructor.hpp>

class MyWrapper {
MyWrapper() { }

  void doThis() { }
  int doThat(int a, float b) { }


extern “C”
void Init_wrapper()
.define_method(“do_this”, &MyWrapper::doThis)
.define_method(“do_that”, &MyWrapper::doThat);


require ‘mkmf-rice’


require ‘wrapper’
c = MyWrapper.new
c.do_that(1, 2.0)