[omniORB] Nesting IDL files
Duncan Grisby
dgrisby@uk.research.att.com
Mon, 23 Apr 2001 17:17:39 +0100
On Friday 20 April, "Olaf Meding" wrote:
> omniORB does not seem to deal with nested IDL files correctly or maybe I am
> doing something wrong? The IDL compiler has no problem compiling the main
> and nested idl files. However, when I compile the files produced by the IDL
> compiler with VC6 I get an error saying that a header file is missing. The
> name of the header file is the name of the nested IDL file.
>
> Here is my (abreviated) IDL file:
> module tcorba {
> // losts of code shared by all of our IDL files
>
> #include "name.idl"
> }
omniidl's C++ back-end is somewhat broken when it comes to IDL like
this. However, it's generally a very bad idea to use #include anywhere
other than at file-scope, since it can lead to all sorts of problems.
It basically prevents any sort of separate compilation of IDL files,
since the definitions in name.idl only have the right C++ scoped names
if included from the file module tcorba is defined in. That's what
causes omniidl to do the wrong thing since it's trying to allow
separate compilation.
It's also very fragile. Imagine someone wants to use a type from the
CosNaming module in name.idl, so they add #include <Naming.idl> to the
to of name.idl. Now all the definitions from CosNaming should appear
in module tcorba!
I'll think about the best way that omniORB can have consistent
behaviour with this sort of IDL, but by far the best thing for
application authors to do is to avoid the issue and only #include at
file scope.
Cheers,
DUncan.
--
-- Duncan Grisby \ Research Engineer --
-- AT&T Laboratories Cambridge --
-- http://www.uk.research.att.com/~dpg1 --