In a Ruby C extension, I would like to call function "rb_eval_string". If Ruby "eval" is monkey patched, is the C function call the monkey patched version, or the original kernel version?
Neither. It calls the C function. It doesn't call either of the Ruby methods, because C doesn't know about Ruby methods.
C doesn't know about monkey patching. There is no such thing as "monkey patching" in C. If you call a C function, you call a C function, not a completely different C function.
If you want to perform a Ruby message send, using Ruby message dispatch rules, you cannot call a C function, or more precisely, you need to call a C function that performs a Ruby message send and does the lookup and so on, which (confusingly) isn't called send
in YARV but rather funcall
. There are a number of variations of them, all called some variation of rb_funcall
.