On Wed, Feb 26, 2003 at 05:33:58AM +0900, Edward Wilson wrote:
> > But what do you need the C files for? Everything they provide is in
> > libruby.{so,a,dll?}.
> > 
> > And the only lib you have to take care of is libruby; the extensions
> > are handled by Ruby and you don't have to link against them. Unless you
> > want to create a single executable with everything, I guess you could then
> > build Ruby to use static linkage or utilize exerb on Windows.
> 
> Thanks for sticking with me on this thread.
> 
> I would like to embed ruby inside of a C application.  I haven't found
> the examples in the few ruby books that exist to be helpful.  I was
> told to use rb_protect() as a wrapper, then I discovered that eval.c
> the source that defines `rb_protect()' isn't included in the standard

batsman@tux-chan:~$ nm --dynamic /usr/lib/libruby.so | grep rb_protect
00021d1c T rb_protect
0000e048 T rb_protect_inspect

> binary RPMs, but is in the latest CVS sources.  Then what I discovered
  ^^^^^^                vs              ^^^^^^^
> was that the `make install` hack doesn't install eval.c into the
> normal /usr/loca/ruby/src directory as I would have expected it to. 
> That's how we got so far into this thread.

'make install' is no hack, it belongs to the standard procedure
  ./configure
  make
  make install

This generally doesn't install the sources. 
 
> All I want to do is "zooma, zoom zoom and a boom boom"©∆rr, start
> hacking ruby at the C level without having to case loose files all
> over the place.  Building extensions was easy; I'm not having the same
> luck embedding ruby however.  The Ultimate magic would for someone to
> post a code snippet that one could clone for their own project.  The
> examples in books have been foo bar so far.

Normally Ruby isn't embedded but extended, so you won't find many examples
of the former.  Another approach often used is wrapping legacy code with
SWIG and for instance mapping C++ classes to Ruby, and then controlling
everything from a Ruby script.

-- 
 _           _                             
| |__   __ _| |_ ___ _ __ ___   __ _ _ __  
| '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ 
| |_) | (_| | |_\__ \ | | | | | (_| | | | |
|_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_|
	Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

"You, sir, are nothing but a pathetically lame salesdroid!
I fart in your general direction!"
	-- Randseed on #Linux