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

Discussion in 'Ruby' started by Charles Comstock, Jun 25, 2004.

  1. 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
    Charles Comstock, Jun 25, 2004
    #1
    1. Advertising

  2. Charles Comstock

    Lyle Johnson Guest

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

    On Sat, 26 Jun 2004 06:38:04 +0900, Charles Comstock <> 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?


    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
    http://www.swig.org/Doc1.3/Python.html#n32) 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
    Lyle Johnson, Jun 25, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Honne Gowda A
    Replies:
    2
    Views:
    865
    Karl Heinz Buchegger
    Oct 31, 2003
  2. andy6
    Replies:
    2
    Views:
    752
    andy6 via DotNetMonster.com
    Jun 9, 2006
  3. stefan
    Replies:
    3
    Views:
    424
    stefan
    Dec 8, 2004
  4. Richard Tobin
    Replies:
    24
    Views:
    772
  5. Bob
    Replies:
    5
    Views:
    254
Loading...

Share This Page