[macruby] #109: rb_eval_string does not work properly
#109: rb_eval_string does not work properly ---------------------------------+------------------------------------------ Reporter: tali.wang@gmail.com | Owner: lsansonetti@apple.com Type: defect | Status: new Priority: critical | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Following codes crash the app. #import <Cocoa/Cocoa.h> #import <MacRuby/MacRuby.h> int main(){ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; RUBY_INIT_STACK; ruby_init(); rb_eval_string("puts 1234"); rb_eval_string("puts 34"); rb_eval_string("a=1234"); rb_eval_string("b=a+1234"); rb_eval_string("puts a+b"); [pool release]; return 0; } Readout: 1234 34 <dummy toplevel>: [BUG] Bus Error MacRuby version 0.3 (ruby 1.9.0 2008-06-03) [universal-darwin9.4] -- stack frame ------------ 0000 (0x30030): 00000004 0001 (0x30034): 00000001 <- lfp <- dfp -- control frame ---------- c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP --------------------------- -- backtrace of native function call (Use addr2line) -- 0x2b5fe6 0x1dee1c 0x1dee5b 0x26ff7b 0x9063509b 0xffffffff 0x1e3c63 0x2ad820 0x2adc81 0x2adfd1 0x1f18 0x1e52 ------------------------------------------------------- Abort trap -- Ticket URL: <https://www.macruby.org/trac/ticket/109> macruby <http://macruby.org/>
#109: need Objective-C APIs for the runtime ---------------------------------+------------------------------------------ Reporter: tali.wang@gmail.com | Owner: lsansonetti@apple.com Type: defect | Status: new Priority: minor | Milestone: MacRuby 1.0 Component: MacRuby | Resolution: Keywords: | ---------------------------------+------------------------------------------ Changes (by lsansonetti@apple.com): * priority: critical => minor * summary: rb_eval_string does not work properly => need Objective-C APIs for the runtime * milestone: => MacRuby 1.0 Comment: Initializing MacRuby is a little bit tricky, doing what you pasted is unfortunately not enough. I plan to introduce an Objective-C API for MacRuby core to easily initialize and use MacRuby from Objective-C, but in the meantime you will have to use the C API. To initialize MacRuby, you can look at the macruby_main() function, defined in objc.m, and mimic what it does. -- Ticket URL: <http://www.macruby.org/trac/ticket/109#comment:1> macruby <http://macruby.org/>
#109: need Objective-C APIs for the runtime ---------------------------------+------------------------------------------ Reporter: tali.wang@gmail.com | Owner: lsansonetti@apple.com Type: defect | Status: closed Priority: minor | Milestone: MacRuby 0.4 Component: MacRuby | Resolution: fixed Keywords: | ---------------------------------+------------------------------------------ Changes (by lsansonetti@apple.com): * status: new => closed * resolution: => fixed * milestone: MacRuby 1.0 => MacRuby 0.4 Comment: Since r652 MacRuby now exposes a simple Objective-C API to initialize the runtime and evaluate expressions. See the objc.h header file in the header for more information. -- Ticket URL: <http://www.macruby.org/trac/ticket/109#comment:2> MacRuby <http://macruby.org/>
participants (2)
-
macruby
-
MacRuby