Ruby support #1

Open
jaroslaw wants to merge 165 commits from ruby into main
3 changed files with 3 additions and 15 deletions
Showing only changes of commit 6bce009e04 - Show all commits

View file

@ -1,7 +0,0 @@
[build]
# Without this flag, when linking static libruby, the linker removes symbols
# (such as `_rb_ext_ractor_safe`) which it thinks are dead code... but they are
# not, and they need to be included for the `embed` feature to work with static
# Ruby.
# rustflags = ["-C", "link-args=-lz", "-C", "link-dead-code=on"]
rustflags = ["-C", "link-args=-lz"]

3
build.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
println!("cargo:rustc-link-lib=z"); // TODO: if features Ruby
}

View file

@ -76,14 +76,6 @@ impl RubyThread {
let mut variable_in_this_stack_frame: VALUE = 0; let mut variable_in_this_stack_frame: VALUE = 0;
ruby_init_stack(&mut variable_in_this_stack_frame as *mut VALUE as *mut _); ruby_init_stack(&mut variable_in_this_stack_frame as *mut VALUE as *mut _);
rb_sys::ruby_init(); rb_sys::ruby_init();
let opts = ["-e", ""];
let mut argv = vec![];
argv.extend(opts.iter().map(|s| CString::new(*s).unwrap()));
let mut argv = argv
.iter()
.map(|cs| cs.as_ptr() as *mut _)
.collect::<Vec<_>>();
ruby_options(argv.len() as i32, argv.as_mut_ptr());
}; };
while let Ok(f) = receiver.recv() { while let Ok(f) = receiver.recv() {
let ruby = Ruby::get().expect("Failed to get a handle to Ruby API"); let ruby = Ruby::get().expect("Failed to get a handle to Ruby API");