Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Ruby Programming/Embedding Ruby

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Embedding Ruby Full Ruby You can embed Ruby your other C apps, though it is a bit tricky. http://stackoverflow.com/questions/239315/how-to-embed-ruby-in-c is a good reference. The trickiest part is I think you can only run it from your apps "main" thread or else it won't do its stack-traversal for garbage collection right. This may not be the case with jruby or Rubinius et al, and possibly might not be the case for 1.9, too (might work there). Basically you can call any "rb_" method defined in ruby.h after calling init, and they all return you a VALUE object (ruby object). NB that you can call from ruby into C by writing a C extension. That is the standard way to go. mruby mruby a light weight implementation of Ruby 1.9 written by matz, the original Ruby developer. It allows you to run multiple copies of Ruby inside one program, and is easier to integrate with other software than the full Ruby interpreter. It's github page is here: https://github.com/mruby/mruby