I've got a c++ application that I want to be able to embed ruby in.
I want to:
- Construct a ruby object
- Load a ruby file and call a specific function with that object as an argument
- Get the return value from that function call in C++ code
Questions:
- Is it possible to pass the object into the ruby script? If so, can you give a brief example or point me to one?
- 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]
- 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.