RPC Wrapping
Rob McDonald <[email protected]> Thu, 6 Oct 2022 22:25:22 -0700
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <CAEppYpEe8sW==_XdSTnYiRDpxN0egTUiF=e3b_=mHb_tWnjm8Q@mail.gmail.com> |
In searching for solutions to a problem, I've come across a number of old
mailing list posts where William mentioned that he was considering adding
an RPC capability to SWIG.
It doesn't look like anything came of that -- does anyone know of anything
similar?
I have wrapped my C++ program with SWIG and typically call it from Python.
I need to run GUI event loop of the C++ program -- and I need to do it
concurrently with Python still running.
While building the SWIG wrapper with -threads and running the C++ in a
separate thread got me closer, it turns out that the GUI library I use will
only work if the event loop is in the main thread. This kind of
requirement seems to be common (and OS dependent). With an end effect that
this won't work as a thread of the main Python instance.
Instead, I need to run my C++ program as an entirely separate process --
either stand-alone or under a second instance of Python. I then need to
communicate between the primary Python thread and my stuff via some sort of
RPC.
Ideally, I would like the RPC version to be available via the exact same
API -- i.e. the only change a user would need to make would be to change
'import foo as foo' to 'import foo_rpc as foo' and everything else in their
program would remain the same.
If there was a C++ RPC library that would invisibly extend a C++ API in
this manner, I could then wrap that with SWIG and hopefully achieve the
desired result.
Alternatively, if there is a Python package that will invisibly create an
RPC wrapper for an existing Python API, that could work too.
Unfortunately, so far all the RPC tools I have found operate with the
assumption that the library user wants to be explicitly aware they are
using an RPC tool. Every command ends up issued through some sort of
socket.send('foo','dosomething') instead of a transparent foo.dosomething().
Any help is appreciated,
Rob
_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user