From: Chris Uzdavinis Date: 2001-05-08T08:40:36+09:00 Subject: [ruby-talk:14830] Re: Embedding RUBY "Bernhard Glk" writes: > I just have one simple question, since i don't seem to find anything on this > out there. I know i can extend Ruby with C/ C++ modules but is it possible > to embedd RUBY in a C++ application ? I would like to use it for in game > scripting in my current game engine .... but the main programm has to stay > in C++ .. > Can anyone confirm if this is possible or not and maybe point me to some > documents on this topic ? Sure it's possible. Look in the main.c file in the ruby source to see how the main application for ruby is setup. You can put those statements in your C++ program and suddenly your application is running ruby. You can also make use of the rb_eval_string() if your application has ruby code to evaluate, whenever you need it. Also, read chapter 17 of the pickaxe book, it covers a lot (but certainly not all) of what you can do with ruby in a C (C++) application. I've written a C++ application that is a corba client, which extends ruby and embeds the interpreter in it. Works very nicely, which is especially impressive considering how little I know about ruby. :) -- Chris