From: Jeremy Hinegardner Date: 2008-12-17T06:15:06+09:00 Subject: Re: Invoking Ruby code from a low-level language? On Wed, Dec 17, 2008 at 05:22:10AM +0900, Alex Fulton wrote: > Wow, thanks for the replies everyone. This has given me a lot of > material to get going on (and my boss is now getting irate because I'm > spending too much time researching options and not enough time actually > coding :P). > > But I've done some research on embedding ruby interpreters (via ruby.h), > and while it seems like this task should be almost trivially easy, I > can't seem to find a copy of the actual embedded interpreter library and > headers. I did a search on my computer (a Mac) for ruby.h, and it turned > up some platform-specific ruby embedding stuff for making OSX apps, but > I'm interested in a more generic solution. > > Any thoughts? There isn't anything different to link against for the embedded ruby interpreter vs the noral interpreter. Its the same library libruby or libruby-static depending on your compilation shared/static needs. The ruby.h that you found is probably the ruby.h that you need to look at. On my Mac, the ruby.h is: mac shipped ruby : /usr/lib/ruby/1.8/universal-darwin9.0/ruby.h ports ruby : /opt/local/lib/ruby/1.8/i686-darwin9.5.0/ruby.h One thing you could do to see how to build an application that uses embedded ruby is to look at crate. It is has a very thin wrapper around embedded ruby. http://github.com/copiousfreetime/crate/tree/master/data/crate_boot.c Pretty much everything I used to figure out embedded ruby was http://metaeditor.sourceforge.net/embed/ and the 'Embedding a Ruby Interpreter' section in the Programming Ruby 2nd ed. hopefully that will help some. enjoy, -jeremy -- ======================================================================== Jeremy Hinegardner jeremy@hinegardner.org