On 16/02/07, Harold Hausman <hhausman / gmail.com> wrote:
> 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
>
>

Programming Ruby (Pragmatic Programmers) has a nice section on
embedding Ruby. Also have a look at README.EXT in the Ruby source
code.

Farrel