From: ts Date: 2002-11-22T01:33:23+09:00 Subject: Re: Questions about embedding Ruby in C >>>>> "J" == Johan Persson writes: J> Is this kind of operation possible? Well, this is very quickly written pigeon% cat a.c #include static VALUE aa_func(obj) VALUE obj; { rb_p(rb_str_new2("I'm is ruby_func")); return obj; } int main() { ruby_init(); ruby_init_loadpath(); rb_define_method(rb_cObject, "ruby_func", aa_func, 0); rb_p(rb_str_new2("before b.rb")); rb_load_protect(rb_str_new2("b.rb"), Qfalse, 0); rb_p(rb_str_new2("after b.rb")); } pigeon% pigeon% cat b.rb #!/usr/bin/ruby p "before ruby_func" ruby_func p "after ruby_func" pigeon% pigeon% a.out "before b.rb" "before ruby_func" "I'm is ruby_func" "after ruby_func" "after b.rb" pigeon% Guy Decoux