From: Mohit Sindhwani Date: 2008-04-24T20:50:25+09:00 Subject: Re: Calling C functions from Embedded Ruby Interpreter Hello Again, I found that the example on this page: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/155482 does have the necessary to help me connect the dots. I was staring at the example for quite a while before I sent the email out, but I guess I just didn't see it. Thanks anyway. Cheers, Mohit. 4/24/2008 | 7:48 PM. Mohit Sindhwani wrote: > Hi Everyone, > > I know the subject line is quite a mouthful! Sorry about that. > > I've managed to embed a Ruby interpreter into my application and I can > call Ruby functions from the code in my application. It works fine > and returns results to me as expected. I can also ask it to run a > script for me. > > Now, I'd like to get it to do some automation for me. My project > starts up, loads a few things, sets a few properties, etc. I'd like > to be able to automate this using the embedded interpreter. I expect > the code in the script may be as simple as: > set_default_color(0x00ff0000) > set_screen_size(800,600) > ...and so on. > > Now, as I understand it, in my application, I need to these C > functions in it: > VALUE set_default_color (VALUE color) > VALUE set_screen_size (VALUE w, VALUE h) > ... and so on. > > I just don't know what to do next! I'm not even sure what I should > search for - should I like at how to create an extension? Does that > mean that I need to get into the mkmf, etc. and compile some things > for it to work (I shudder because my primary environment is Borland > C++ Builder/ Turbo C++ and I had enough worries getting the > interpreter to be compiled in). > > To use the script from the embedded interpreter, can I just ask it to > run the script? > > I'm sorry if some of the questions/ explanations are a bit vague. Any > help/ direction is greatly appreciated. > > Thanks > Mohit. > > > >