3

I've got a c++ application that I want to be able to embed ruby in.

I want to:

  1. Construct a ruby object
  2. Load a ruby file and call a specific function with that object as an argument
  3. Get the return value from that function call in C++ code

Questions:

  1. Is it possible to pass the object into the ruby script? If so, can you give a brief example or point me to one?
  2. Is it possible to get the return value as an object out of the script into the C++ code? If so, can you give a brief example or point me to one?

Additional Reading

Referencing this SO question in case someone is reading here and wondering how to embed the ruby interpreter in their c++ application.

[updates]

  1. I found this discussion about doing exactly what I'm talking about. So, I would say that the answer is definitively yes, what I'm trying to do is possible. I'll post an example using Rice a bit later, or on my blog.
Community
  • 1
  • 1
bitcycle
  • 7,632
  • 16
  • 70
  • 121

0 Answers0