On Wed, Aug 21, 2002 at 05:10:50AM +0900, Edward Wilson wrote:
> My question is: is this doable?  I have tried in the past to embed
> Ruby and hit a wall, I have been hoping that this would be resolved as
> Ruby matured.  Is Ruby maturing in the embedable direction?

Sure, it's doable.  There are a few issues to consider, though:

1) You will probably want to avoid or limit the use of threads in your
   Ruby code.  They don't always play well with C++, in my experience.

2) You need to consider exception-safety.  C++ exceptions should never
   escape into Ruby code, and Ruby exceptions should never escape into
   C++ code.  If they do, you will have undefined behavior (possibly a
   program crash).  Remember that even something as simple as NUM2INT
   can raise an exception.  You will find a friend in rb_protect() and
   rb_jump_tag().

3) If you use gcc 3.x, then use Ruby 1.7, if possible.  It has much
   better const-correctness and function declarations (particularly
   functions that take '...').

There are many other minor issues, but these are the ones that show up
often on the mailing list.

Paul