From: Joel VanderWerf Date: 2001-12-07T09:51:24+09:00 Subject: [ruby-talk:27774] passing a block from C to Ruby In my C function, which is in fact a #new method, I call initialize: rb_apply(object, ID_of_initialize, args); This works, but it doesn't pass the block that new is called with. Half of a solution is to use rb_scan_args to make a Proc using the block. But I still don't know how to do the C equivalent of object.initialize *args, &a_proc None of the rb_funcall functions seem to do it, and rb_iterate isn't right either, since it asks for C functions, not Ruby objects. So, two questions: 1. How do I call, from C, a Ruby method, with a Proc object passed in as the block? 2. Is there a way I can call a method and indicate to Ruby that the block associated with it should be the same as the block in the current context? (This would be more efficient than 1.) -- Joel VanderWerf California PATH, UC Berkeley mailto:vjoel@path.berkeley.edu Ph. (510) 231-9446 http://www.path.berkeley.edu FAX (510) 231-9512