[omniORB] Injecting Enum Name/Values into Enum's Namespace

Duncan Grisby duncan at grisby.org
Wed Sep 21 16:14:35 BST 2005


On Wednesday 21 September, Jeff Pitman wrote:

> Maybe I'm not sending this stuff in right to omniidl.  With fnidl, I 
> just had to send in an idl called "All.idl".  The "All.idl" would then 
> #include a bunch of other external idls.  However, it appears that the 
> omniidl does not recursively include these on parse and does not 
> process them without ensuring they're all included on the commandline.

Yes, by default omniidl only compiles the actual declarations inside the
IDL file(s) you specify, not any #included files. It does that to
support separate compilation, so you can compile just those files that
are relevant, and recompile individual ones when you need to.

You can indeed use -Wbinline to include all #included files in the
generated stub file, but you then lose the ability to do separate or
partial compilation. It is generally best to do separate compilation of
IDL files, resulting in one stub file with the extension _idl.py for
each input IDL file.

> All.idl is like this:
> 
> module com {
>         module example {
>                 module interfaces {
> 			#include "foo.idl"
> 			#include "bar.idl"
>                 };
>         };
> };

Using #include within modules like that a very risky thing to do.
#include is only safe to use at module scope. The reason is that many
(most?) IDL compilers don't properly follow the rules about repository
identifiers. Imagine foo.idl contains an interface:

  interface Test {
    ...
  };

Now, all interfaces are assigned a "repository id", which is a string
uniquely identifying the interface. The repository id is required for
things like the _narrow operation. According to the CORBA spec, the
repository id for the Test interface is "IDL:Test/1.0". However, with
many IDL compilers, if you give them the All.idl file, they will think
the repository IDL of Test is "IDL:com/example/interfaces/Test:1.0".
Now, omniORB (which gets the id right) will not be able to narrow
objects exported by ORBs with broken IDL compilers.

All #includes should be at top-level. Each #included file should reopen
the modules it belongs inside.

Cheers,

Duncan.

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



More information about the omniORB-list mailing list