[omniORB] omniidl breaking (?) on forward declaration in file included from within 'module'

Duncan Grisby duncan at grisby.org
Tue Feb 28 20:48:06 GMT 2006


On Tuesday 28 February, Dietmar May wrote:

> I'm getting an error from the 4.0.7 win32 omniidl compiler. It seems
> to be having a problem with an interface that is forward declared
> within a separate source file that is included within an IDL module {
> }. The error states that the forward declaration is in module "",
> whereas the interface definition is in module "Mod". In reality, both
> are declared within the same module. The identical construct (same
> source code) works fine in omniORB 2.80.

It's not a bug in omniidl -- your IDL is wrong, I'm afraid. Notice that
omniidl says:

c_core.idl:18: In declaration of interface 'Consumer', repository id
prefix 'Mod' differs from that of forward declaration
c_base.idl:15:  ('Consumer' forward declared here with prefix '')

It's not complaining about the module name, it's complaining about the
"repository id prefix". Read section 10.6 of the CORBA 2.6 spec to see
the rules about how repository ids are generated. In particular, notice
this example on page 10-47:

--------
If an included file does not contain a #pragma prefix, the current
prefix implicitly resets to the empty prefix:

     // E.idl
     interface E {};

     // F.idl
     module M {
       #include <E.idl>
     };

The repository IDs for module M and interface E in this case are:

     IDL:M:1.0
     IDL:E:1.0

--------

In the example, if E was directly defined in M, rather than in a
separate file, its repository id would be IDL:M/E:1.0.

Slightly later on the same page:

--------
Forward-declared constructs (interfaces, value types, structures, and
unions) must have the same prefix in effect wherever they appear.
Attempts to assign conflicting prefixes to a forward-declared construct
result in a compile-time diagnostic.
--------


The simple fix is to never #include IDL files from inside a module. If
you want multiple files to put declarations into the same module as each
other, simply reopen the module in multiple files.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --



More information about the omniORB-list mailing list