Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
[ANN] Rice 1.0.1 - Bug Fixes
Jason Roelofs
2/18/2008 5:50:00 PM
Rice: Ruby Interface for C++ Extensions
========================================
Change Log:
* Fixed x86_64 bit install bug with -fPIC
* Fixed the tarball and zip file, they were missing an essential
configuration file.
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.rub...
Project Page:
http://rubyforge.org/pro...
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>("MyWrapper")
.define_constructor(Constructor<MyWrapper>())
.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 extensions have never been so easy!
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
[ANN] Rice 1.0.1 - Bug Fixes
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password