Hi,

Let's say I have a file called point.rb:

    +----------------------------------------------------------+
    |   class Point                                            |
    |       def initialize (x, y)                              |
    |           @x = x ; @y = y                                |
    |       end                                                |
    |       ...                                                |
    |   end                                                    |
    +----------------------------------------------------------+

Now, I'm making a Class `Curve', implemented in C.  In curve.c I have

    +----------------------------------------------------------+
    |   void Init_Curve() {                                    |
    |       ...                                                |
    |       rb_define_method(cCurve, "test", curve_test, 0);   |
    |       rb_require("point.rb");                            |
    |   }                                                      |
    +----------------------------------------------------------+

I want the test method to return Point.new(3,4) and I think this is
one way to do it:

    static VALUE
    curve_test(VALUE self)
    {
        return rb_eval_string("Point.new(3,4)");
    }

But is there a way to do it without rb_eval_string (and with
rb_funcall or whatever)?

Additional question: Currently I have an empty init function (it just
returns self), which I do bind to "initialize" in Init_Curve and I
also call rb_obj_call_init from curve_init.

    - Is it necessary to call rb_obj_call_init even though my init
      function is empty?
    - Is it necessary to define the init function at all?

Even more questions: I am rewriting a couple of ruby extensions
(written in ruby) in C and I'm doing this one module at a time.  Let's
say I have files called a.rb, b.rb, c.rb, where each file requires the
previous file.  When writing a.c, b.c, c.c would you use

    rb_require("b.so");

in c.c or would you use a and b somehow on the C-level?

I hope my questions make sense.


Richard
-- 
Alcohol and calculus don't mix. Never drink and derive.