[MacRuby-devel] Using the MacRuby framework to embed ruby in Objective-C

Luke Evans luke at eversosoft.com
Tue Nov 25 14:57:18 PST 2008


Hi,

Thanks for MacRuby, I'm going to follow its development closely.   
While I wouldn't use Ruby (without static typing) for large-scale  
development, IMHO, it is my favourite scripting language for those  
"little jobs", and I'm currently interested in it as an embedded  
language in my app.

Given the interest, I thought I would try creating a mini obj-c  
project, including the MacRuby framework, to attempt some simple  
interactions with ruby from obj-c.  Accordingly, I created some toy  
code:

- (void)awakeFromNib {
	ruby_init();
	rb_eval_string("puts 'hello world'");
	ruby_finalize();
}

Running my little app, results in a series of messages of the form"
warning: Could not find object file "/private/tmp/trunk/xxxxx.o" - no  
debug information available for "xxxxx.c"
where xxxxx are things like "array", "bignum", "class", "compar", ...  
etc.

The app then crashes with a stack walk back containing a huge number  
of nested exceptions (it seems).

Now, it's quite possible that I'm just not driving this right (to date  
I've always scripted in Ruby, and never attempted to drive it from  
C).  Equally, I'd imagine that it's possible that the 0.3 version of  
the framework isn't up to this yet.
If I can get past this point, I can see the objective-c interfacing  
functions in the header file, so things might be peachy from then on :-)

Can anyone enlighten me?

Cheers

Luke


  


More information about the MacRuby-devel mailing list