From: Sean Middleditch Date: 2001-05-29T09:21:39+09:00 Subject: [ruby-talk:15900] Re: embedded ruby On Tue, May 29, 2001 at 03:10:04AM +0900, Tom Spilman wrote: > > I don't think you need to even call ruby_run (). If your app > > is using Ruby as an internal scripting language, then you need > > to call Ruby objects/method, not have Ruby guide your app. > > If that's what you want to do, then you should make a Ruby > > extension instead. > > That would mean writing my own parser for ruby.... that seems a bit of a > waste of effort since ruby does this itself just fine. I'm currently > experimenting with the possibilities of embedded ruby and have run into a > similar situation. Tom Why do you have to write a parser? Just load the Ruby code, and then use stuff like rb_funcall() to execute certain methods. > > "Sean Middleditch" wrote in message > news:20010528123705.A18859@stargrazer.aweplay.net... > > On Tue, May 29, 2001 at 12:21:12AM +0900, Wesley J Landaker wrote: > > > Hello list, =) > > > > > > Has anyone had success embedding a ruby interpreter? > > > > Yep! Just last week I got one running beautifully in AweMUD. ^,^ > > > > > > > > It seems straightforward enough, except for the fact that ruby_run() > > > calls ruby_stop() when it finishes, which in turn calls exit() (which > > > terminates the whole program!). This means that you can really only use > > > ruby_run() *once* (and if you want to continue your program, you have > > > to trap the exit...) > > > > I don't think you need to even call ruby_run (). If your app is using Ruby > as an internal scripting language, then you need to call Ruby > objects/method, not have Ruby guide your app. If that's what you want to > do, then you should make a Ruby extension instead. > > > > > > > > Other than a quick hack on the source tree to make it NOT do that (what > > > I'm using now) is there some other way to make ruby_run() not call > > > exit(), or is this just a bug that no one has run in to? > > > > > > I'm using the latest version right out of CVS. It's possible that this > > > used to work and got broken somewhere along the way. > > > > What exactly are you trying to do? > > > > > > > > -- > > > Wesley J. Landaker - wjl@mindless.com > > > http://www.landaker.net PGP DSS/DH Key: 0x0F338E07 > > > PGPKey FP: 3AAA 424B B488 198E B68B C0E5 390A BACA 0F33 8E07 >