Questions about SWIG, Ruby/DL and embedding calls to ruby within C++ Code

Is there any sort of tutorial on calling ruby functions from C++ code? I looked at the documentation for SWIG and that all seems to be for wrapping a C++ class in a ruby object, which is all well and good for many uses but what if you are trying to say derive from a C++ base class and then write the code in Ruby. I'm not sure if SWIG allows this and I'm just misreading the directions or if this is possible through some other route. Anybody have any experience with this problem?

Charles Comstock

The latest versions of SWIG (in the 1.3.x development series) provide
support for so-called "director" classes, which allow you to subclass
wrapped C++ classes with Ruby classes and then override their virtual
member functions. This feature is documented a bit (see
SWIG and Python) but because the feature's
still fairly new, you may not many examples of it in the wild.

If you decide to give this a whirl and run into problems, please feel
free to follow up with me or on the SWIG users' mailing list.

Hope this helps,

Lyle

ยทยทยท

On Sat, 26 Jun 2004 06:38:04 +0900, Charles Comstock <cc1@cec.wustl.edu> wrote:

Is there any sort of tutorial on calling ruby functions from C++ code?
I looked at the documentation for SWIG and that all seems to be for
wrapping a C++ class in a ruby object, which is all well and good for
many uses but what if you are trying to say derive from a C++ base class
and then write the code in Ruby. I'm not sure if SWIG allows this and
I'm just misreading the directions or if this is possible through some
other route. Anybody have any experience with this problem?