集成 Jython Cpython

发布于 2024-09-01 21:14:37 字数 397 浏览 7 评论 0原文

我即将开始一个项目,我可能会使用 PyQt 或 Pyside。

我需要与提供 C++ 和 Java API 的有缺陷的第 3 方服务器软件进行交互。 Java API 更容易使用,因为使用 C++ 库会出现段错误,而会出现异常。此外,Jython 会自动将 Python 绑定到 Java API,而 C++ API 的 Python 绑定不存在。

那么,CPython PyQt 客户端应用程序如何与这些 Java API 进行通信呢?你会怎样做呢?

您是否会在客户端上有另一个单独的 Java 进程来序列化/pickles 对象并通过套接字与 PyQt 进程进行通信?

我不想重新发明轮子......这些类型的东西有某种标准接口吗?我应该研究一些技术? RPC、Corba 等?

谢谢, ~埃里克

I am about to begin a project where I will likely use PyQt or Pyside.

I will need to interface with a buggy 3rd party piece of server software that provides C++ and Java APIs. The Java APIs are a lot easier to use because you get Exceptions where with the C++ libraries you get segfaults. Also, the Python bindings to the Java APIs are automatic with Jython whereas the Python bindings for the C++ APIs don't exist.

So, how would a CPython PyQt client application be able to communicate with these Java APIs? How would you go about it?

Would you have another separate Java process on the client that serializes / pickles objects and communicates with the PyQt process over a socket?

I don't want to re-invent the wheel... is there some sort of standard interface for these types of things? Some technology I should look into? RPC, Corba, etc?

Thanks,
~Eric

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

白衬杉格子梦 2024-09-08 21:14:37

如果您想保持完全隔离并提高稳健性(第 3 方库关闭并且不带走您的客户端,如果它有问题我会建议这样做),那么也许像 CORBA 这样的东西是前进的方向。不要忘记 Java 附带了 CORBA 实现作为标准,因此您只需从 IDL 生成 C 代理即可。

如果您想在进程中运行内容,Swig 可能会感兴趣。它简化了不同语言组件的绑定。请特别注意,它生成 Python 和 Java 的绑定

If you want to maintain complete isolation and increase your robustness (the 3rd party library going down and not taking your client, and if it's buggy I would recommend that) then perhaps something like CORBA is the way forwards. Don't forget that Java comes with a CORBA implementation as standard, so you just need to generate your C proxy from the IDL.

Swig may be of interest if you want to run stuff in-process. It simplifies the binding of components in different languages. Note in particular that it generates bindings for Python and Java.

作业与我同在 2024-09-08 21:14:37

如果标准不是重新发明轮子,则标准库中提供了 SimpleXMLRPCServerxmlrpclib 模块。他们也应该在 Jython 中工作。

If the criteria is not reinventing the wheel, there is the SimpleXMLRPCServer and xmlrpclib modules available in the standard library. They should work in Jython too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文