C++到 IDL 工具

发布于 2024-08-02 16:39:23 字数 54 浏览 1 评论 0原文

有没有可以将 C++ 代码转换为 idl 的免费工具?我正在考虑类似于java2idl的东西。

Are there any free tools that convert c++ code to idl? I am thinking of something similar to java2idl.

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

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

发布评论

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

评论(1

南风几经秋 2024-08-09 16:39:23

Java2idl 是一种特殊情况……它以字节码作为输入,因此它使用反射来决定类的外观,然后写出兼容的 IDL。由于 C++ 不容易支持反射,因此您需要一个源解析器/预处理器。

除了学生课堂项目之外,我从未遇到过免费的 IDL 生成器。大多数人需要走另一个方向...定义一个接口或类来在 C++ 和 CORBA 中实现,因此他们首先直接用 IDL 编写它。

如果您使用少量代码,请手动进行转换。如果数量很大,您将需要花钱购买工具或花时间编写自己的工具。您可以使用诸如 boost 序列化之类的方法进行自己的“反思”,以帮助自动分析您的结构(对象数据输入,IDL 布局输出)。

Java2idl is a special case...it takes byte code as input, so it's using reflection to decide what the class looks like, then writes out a compatible IDL. Since C++ doesn't easily support reflection, you need a source parser/preprocessor instead.

Other than student class projects, I have never run into free generators of IDL. Most people need to go the other direction...define an interface or class to implement in both C++ and CORBA, and so they directly write it in IDL first.

If you are working with small amounts of code, do the conversion by hand. If it's large amounts, you'll need to spend money on tools or time on writing your own. You could potentially do your own "reflection" using something like boost serialization to help automate analyzing your structures (object data in, IDL layout out).

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