From: Suraj Kurapati Date: 2007-01-07T11:35:36+09:00 Subject: Re: Scriptable text editor with Ruby? Dolazy wrote: > Swig seems to assume that you want to take away the main() method and > treat the C++ code as a shared library. It's not really the same as > interprocess communication. > > The embedding solution also provides one way interaction. The C++ > program calls ruby, but not the other way around. There might be ways > around this, using callbacks or so. I'd like to learn more... > > I suspect that IPC using XmlRpc is the most powerful solution (and easy > to implement). There is an easier way than having ruby in a separate process and having to do IPC via RPC. Simply run ruby within a pthread and give it a SWIG interface to your C++ app. == Option1 If you cannot allow the Ruby thread to asynchronously use your C++ app, then you can set up a mutual exclusion scheme where either (1) the C++ app or (2) the Ruby thread is active at a time. You would then have to provide a way to transfer/relay control between them. In fact, this is how my Ruby-VPI project works. It embeds a Ruby interpreter into a C program that runs within a Verilog. http://ruby-vpi.rubyforge.org == Option2 If that's not the kind of interaction you want, then see: http://metaeditor.sourceforge.net/embed/ -- Posted via http://www.ruby-forum.com/.