I'm using the C Ruby Interface to embed a ruby interpreter in a swift application (though, that I'm using swift is irrelevant Imo)
I feel like Ruby must have some way of completely reinitializing itself.
I'm initializing the vm like so:
var variable_in_this_stack_frame:UnsafeMutablePointer<VALUE>? = nil
ruby_init_stack(variable_in_this_stack_frame)
ruby_init()
ruby_init_loadpath()
rb_require("enc/encdb")
rb_require("enc/trans/transdb")
var node = ruby_options(Int32(options.count), &cargs)
evaluating some code:
var state: Int32 = 0;
if ruby_executable_node(node, &state) != 0 {
state = ruby_exec_node(node)
}
if state != 0 {
throw RubyError(err: RTypedValue(VALUE: rb_errinfo()))
}
and destroying the vm like so:
var state: Int32 = 0
ruby_cleanup(state)
however, second time around doing all this, I get EXC_BAD_ACCESS
when running: ruby_init_loadpath()
how am I supposed to reinit?