Hi.

In message "[ruby-talk:00250] embedding ruby, is there any example?"
    on 99/03/10, Mathowiz / aol.com <Mathowiz / aol.com> writes:

|Specifically, I have a c application in which I want to be able to evaluate an
|arbitrary
|run-time expression string (in c).  Example expr-string like: 
|   "z = xxx + sin(yyy); z", where xxx and yyy are variables in c's
|environment.  That
|means I need put xxx, yyy etc into ruby environment. 

Hmm, eval'ing Ruby's expression is very easy by

  rb_eval_string(char *str);

You need to call ruby_init() first, though.

But, importing C value in Ruby world is not that easy.  Sharing Ruby
value between C and Ruby can be done by

  rb_define_variable(char *name, VALUE *var);

However, you need to convert C value into Ruby value.  It cannot be
done automatically because C value do not have type information, which
every Ruby value have.

See README.EXT, which is almost wholly translated in 1.3.1-990311.
Oh, well, I should notice I'm going to release 1.3.1-990311 today.

                                                matz.