Hi,

At Wed, 25 Aug 2004 15:50:45 +0900,
Phlip wrote in [ruby-talk:110422]:
> That was so simple, I have probably screwed it up!
> 
>     static VALUE sink(VALUE self, VALUE input)
>     {
>         char * got = StringValueCStr(input);
>         cout << got << endl;  //  todo - replace this with something that
> routes the data where I need it
>         return Qnil;
>     }
> ....
>     ruby_init();
>     ruby_script("embedded");
> 
>     rb_define_global_function("sink", RUBY_METHOD_FUNC(sink), 1);

You don't need a global function.

    VALUE out = rb_class_new_instance(0, 0, rb_cObject);
    rb_define_singleton_method(out, "write", RUBY_METHOD_FUNC(sink), 1);
    rb_stdout = out;
    rb_stderr = out;

-- 
Nobu Nakada