From: Stefano Crocco Date: 2007-02-17T00:13:31+09:00 Subject: Re: Using Ruby as an extension language Alle venerd� 16 febbraio 2007, Harold Hausman ha scritto: > I'd like to use Ruby as an extension language for software written on > a Windows-like (actually xbox360) platform in C++. > > Specifically, I'd like to be able to embed a Ruby interpreter into my > application so that I can do the following things: > 1. Call Ruby functions from C++ > 2. Call C++ functions from Ruby > 3. Exchange data between the C++ application the the Ruby interpreter. > > I have experience doing these exact things in Lua. I understand that > doing this in Ruby is going to be more painful than doing it in Lua as > this was one of Lua's primary goals, but what I'm hoping is that it's > *possible* to do it in Ruby. (: > > (because we all know that writing Ruby code is so much more enjoyable > than writing Lua code) > > So. I downloaded the Ruby source. I had to hack it up a bit because > the xbox is slightly different than windows, but I got a red thread > going. (passing scripts in through -e) > > Obviously booting up the interpreter from scratch each time I want to > run some ruby code isn't going to work: > ruby_init(); > ruby_options(); > ruby_run(); > > Is there a document somewhere that describes how to properly use ruby > as an extension language? Is the something comparable to luaL_dofile > or luaL_dostring and lua_register? > > Am I way off base? > > 1000 thanks in advance for any insight, > -Harold There's been a thread on this mailing list about embedding ruby. You may be interested in it. It's at http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/235460 I hope this helps