Files
Jean Boussier 1ba809e748 C API: Expose rb_iseq_load_from_binary
[Feature #22222]

This allows to efficiently load iseq from mmaped files and other
buffers without having to copy the bytes into a Ruby string an
then invoke `RubyVM::InstructionSequence.load_from_binary`.
2026-08-06 10:35:28 +02:00

21 lines
437 B
C

#include "ruby/ruby.h"
static VALUE
eval_string(VALUE self, VALUE str)
{
return rb_eval_string(StringValueCStr(str));
}
static VALUE
iseq_load_from_binary(VALUE self, VALUE str)
{
return rb_iseq_load_from_binary(RSTRING_PTR(str), RSTRING_LEN(str));
}
void
Init_eval(void)
{
rb_define_global_function("rb_eval_string", eval_string, 1);
rb_define_global_function("rb_iseq_load_from_binary", iseq_load_from_binary, 1);
}