When a forward reference to an interface appears within an Interface Definition List (IDL) module, the IDL compiler issues an error message if the referenced interface is not defined within the module. When a similar unresolved forward reference appears at global (file) scope, a warning is issued that indicates the bindings being emitted will not include a mapping for the undefined interface. For information on the scope, see the topic "IDL name scoping". The assumption is that the interface is defined by bindings other than those currently being generated. This approach supports IDL files with mutually-referential interfaces (as long as they appear at global scope). The following example illustrates how to organize the IDL files for such cases:
// file foo.idl #ifndef foo_idl #define foo_idl interface Foo; // declare Foo so bar.idl can refer to it #include bar.idl interface Foo { Bar foo1(); // notice the use of Bar }; #endif // foo_idl // file bar.idl #ifndef bar_idl #define bar_idl interface Bar; // declare Bar so foo.idl can refer to it #include foo.idl interface Bar { Foo bar1(); // notice the use of Foo }; #endif // bar_idl
The following is a known limitation due to problems inherent in the CORBA mapping for C++:
The C++ bindings map attributes into overloaded C++ accessor functions whose name is the attribute name. As a result, the following IDL does not map to useful C++ bindings (because Y's l method interferes with the inherited mapping for X's attribute). If Y's method took any arguments, there would not be a problem because of C++ overloading. The compiler indicates an error only when C++ overloading does not distinguish inherited accessors from newly introduced methods (or vice versa).
interface X { attribute long l; } interface Y : X { long l(); };