java - idjl(Sun IDL 编译器)是否支持前向声明?

标签 java corba idl

必须在我的学校项目中使用idlj,但在我的 idl 文件中我还需要使用前向声明。有谁知道 idlj 是否支持前向声明?我尝试这样做,但它给出了错误:

interface1.idl (line 34): There is a forward reference to Class1, but it is not defined.

有什么想法可以克服这个问题吗?不幸的是,我无法使用任何其他 idl 编译器......而且我找不到任何有关此的信息。

编辑:

接口(interface)1.idl:

interface SecondClass;

interface FirstClass
{
    //...
};

接口(interface)2.idl:

interface FirstClass;

interface SecondClass
{
    //...
};

idlj -fclient interface1.idl

给出:

interface1.idl (line 8): There is a forward reference to SecondClass, but it is not defined. }; ^

最佳答案

#ifndef _SecondClass
#define _SecondClass
#include "interface1.idl"
interface SecondClass
{
   typedef sequence<FirstClass> firstVector;
   SecondClass create();
};
#endif

#ifndef _FirstClass
#define _FirstClass
#include "interface2.idl"
interface FirstClass
{
   typedef sequence<SecondClass> secondVector;
   FirstClass create();
};
#endif

看看this 。将此模式用于所有相互依赖的接口(interface)。

关于java - idjl(Sun IDL 编译器)是否支持前向声明?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12017191/

相关文章:

Java:如何记住保存的文件在哪里

java - 使用 MAPI 连接到邮件服务器

python - SCons - 为 CUDA、CORBA 等集成自定义构建器

java - CORBA ORB 运行时定义本地 IP 接口(interface)使用

python - Corba 事件客户端 ETIMEDOUT

c++ - COM:返回字符串的拷贝,还是实际值?

java - Thrift服务默认参数

java - 实时网络跟踪应用程序

Java 小程序问题 : dll already loaded in another classloader

c++ - 更改 IDL 生成的头文件