Perhaps more generally, how do you pass a block, written in C, to another C function that accepts a block? I know I can do something like this:
VALUE refine_foobar(VALUE block_arg, VALUE data, int argc, VALUE* argv) {
// block code here
return Qnil;
}
void Init_mything() {
VALUE mod = rb_define_module("Foobar");
rb_block_call(mod, rb_intern("refine"), 0, NULL, refine_foobar, Qnil);
}
but I feel like there has to be a way to call rb_mod_refine
directly instead of going through rb_block_call
.
Any ideas? Thanks!