[omniORB] Strange code produced by omniidl2

Nick Brook ncb@adaptivebroadband.com
Wed, 07 Jul 1999 14:13:51 +0100


This is a multi-part message in MIME format.
--------------5F65975C259CBFF194A6AB1B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

David.Chung@USPTO.GOV wrote:
> 
>         (1) if you look at the file weird.idl, bs module precedes the ap
> module.
> This is necessary, because the symbol "bs" within ap module would not be a
> valid reference.
> It is not necessary for a forward declaration to be at the beginning of a
> file, as long as
> the forward declaration precedes the reference which could generate compiler
> error.
> 
>         (2) the forward declaration of ap in odd.idl is not necessary for
> weird.idl, because
> weird.idl declares it again.  In short, weird.idl would compile without
> odd.idl.
> 
>         "odd.idl" seems to be an insurance header file that forward declares
> ap modules,
> to be included in those idl's that reference ap module in one of the
> modules.  But including
> odd.idl does not hurt weird.idl's chances of proper compilation.
> 
>         In summary, there is no bug.
> 
Thanks for the reply.

(1) Yup, but the problem is that the bs::node get_node() method in
weird.idl requires a declaration of bs::node. But this declaration in
the .hh is produced at the end of the file, and so any .cc file that
includes weird.hh won't compile.

(2) I think the problem here is that I've cut the IDL down to the bare
minimum. In my actual su.idl file I have a sufactory::create_su(in
string name, in ap::node ap_ptr) method. I can't #include "weird.idl"
here because they are mutually dependent. I've included new copies of
weird.idl and weirdsu.idl that illustrate this.

If I put the forward reference of bs::node BEFORE the #include
"weirdsu.idl" then it produces correct weird.hh i.e. bs::node appears
before ap::node.

Cheers, 
	Nick
--------------5F65975C259CBFF194A6AB1B
Content-Type: text/plain; charset=us-ascii;
 name="weird.idl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="weird.idl"

//
// -- ap.idl
//
//	Access Point interface.
//
// Copyright (c) 1999 Adaptive Broadband Ltd.
//
#ifndef _weird_idl_
#define _weird_idl_

#include "weirdsu.idl"

module bs
{
    interface node;
};

module ap
{
    interface node 
    {
        bs::node get_node();
        su::node get_su_node();
    };
};

#endif // _ap_idl_

--------------5F65975C259CBFF194A6AB1B
Content-Type: text/plain; charset=us-ascii;
 name="weirdsu.idl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="weirdsu.idl"

//
// -- su.idl
//
//	Subscriber Unit interface.
//
// Copyright (c) 1999 Adaptive Broadband Ltd.
//
#ifndef _odd_idl_
#define _odd_idl_

//#include "weird.idl"  // can't use this due to dependencies, so must forward reference

module ap 
{
    interface node;
};

module su
{
    interface node
    {
        string get_name();
        void create_su(in string name, in ap::node apptr);
    };
};

#endif // _su_idl_

--------------5F65975C259CBFF194A6AB1B--