From: Jason Roelofs Date: 2009-04-27T23:06:45+09:00 Subject: [ANN] rice-1.1.0 with Ruby 1.9.0 compatibility! Rice: Ruby Interface for C++ Extensions ======================================== Change Log: * Works on Ruby 1.8.6, 1.8.7 and 1.9.0 with no changes to current extensions * Fixed memory leaks * Fixed various compilation issues, build uses the system's ruby library and doesn't assume the name of libruby.so * Now properly uses the ruby in --with-ruby for every step of the compilation process (e.g. can be installed on multiple ruby installs on a single system) * Removed all uses of known deprecated APIs, like STR2CSTR * Now builds extensions to allow multiple Rice extensions to be require'd together 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 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: http://rubyforge.org/projects/rice 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? wrapper.cpp #include "rice/Class.hpp" class MyWrapper { public: MyWrapper() { } void doThis() { } int doThat(int a, float b) { } }; extern "C" void Init_wrapper() { define_class("MyWrapper") .define_constructor(Constructor()) .define_method("do_this", &MyWrapper::doThis) .define_method("do_that", &MyWrapper::doThat); } extconf.rb require 'mkmf-rice' create_makefile("wrapper") test.rb require 'wrapper' c = MyWrapper.new c.do_this c.do_that(1, 2.0) Building Ruby wrapper extensions have never been so easy!