Project

General

Profile

Bug #17643

Updated by cfis (Charlie Savage) about 3 years ago

The following code works on Ruby 2.x, but not on Ruby 3.0.0. 

 ``` c 
 // Initialize Ruby VM 
 int argc = 0; 
 char* argv = (char*)malloc(1); 
 argv[0] = 0; 
 char** pArgv = &argv; 

 ruby_sysinit(&argc, &pArgv); 
 ruby_init(); 
 ruby_init_loadpath(); 

 // Try to call GC.start 
 int state; 
 VALUE result = rb_eval_string_protect("GC.start", &state); 
 VALUE err = rb_errinfo(); 
 VALUE rubyMessage = rb_funcall(err, rb_intern("message"), 0); 
 char* message = RSTRING_PTR(rubyMessage); 
 ``` 

 message is Message is: 

 "undefined method `start' for GC:Module" 

 ``` 

 This is true for almost all the GC methods. Note if you create a Ruby script that contains GC.start all is well. 

 Is there some new special way Ruby 3 needs to be embedded? 

 0x00000256e50e3280 "undefined method `start' for GC:Module"

Back