combining ruby and C++

Posted by Shingetsu on Programmers See other posts from Programmers or by Shingetsu
Published on 2012-11-04T01:12:39Z Indexed on 2012/11/04 5:21 UTC
Read the original article Hit count: 410

Filed under:
|
|
|

Hello /* programmers */ (I usually hang in SO)
I've been discussing a conceptual project with a friend of mine and the the most effective way we've seen of doing it is writing the engine in C++ while the logic would be done in Ruby.
However, we would need data to be passed around often, for example:

  • Engine reports that A happened, that gets triggered in a proc array (event "A" is passed but proc doesnt use it)
  • Ruby decides that we need to wait for B to happen
  • Ruby adds a proc to an array. The array of procs is iterated during each cycle in the C++ engine
  • C++ engine reports that B happened and passes "event B (should be a ruby object)
  • Ruby receives event B and decides what to do next

I don't work with multiple languages often, and was wondering if it's possible to implement things in this way. I know that there's the ruby VALUE in C++, but would like to know the standard way of combining the two. (of course I know ruby follows the perl "more than 1 way to do it", but there's often a standardized way)

© Programmers or respective owner

Related posts about c++

Related posts about ruby