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

Dietmar May dcmay at dmis.com
Tue Feb 28 12:29:42 GMT 2006


Hi,

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 looks like omniidl is somehow considering the code in the second file 
to be in a separate namespace or module than the first, simply because 
it's included from a separate file. However, the results of omnicpp show 
what looks like a perfectly reasonably preprocess result.

Brief example:

file1.idl contents --

module Mod
{
#define MOD_INCLUDED
#include "file2.idl"

interface Broken
{
   void do_something ();
};

};

-- end contents

file2.idl contents --

#ifndef MOD_INCLUDED
module {
#endif
interface Broken;
#ifndef MOD_INCLUDED
};
#endif

-- end contents


Here's the error output from the command:

omniidl: Importing back-end 'cxx'
omniidl: 'cxx' imported from 
'c:\programs\omniorb4\lib\python\omniidl_be\cxx\__init__.pyc'
omniidl: Preprocessing 'c_core.idl' with 
'c:\programs\omniorb4\bin\x86_win32\omnicpp -lang-c++ -undef 
-D__OMNIIDL__=0x2420 -I "." -I "c:\programs\omniorb4/include" -I 
"c:\programs\msdev60\include" -I "P:\projects\dot\idl" -D__OMNIIDL_CXX__ 
"c_core.idl"'
omniidl: cpp output to temporary file 'omniidl-tmp2824.idl'
omniidl: Running front end
*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 '')
*omniidl: 1 error.


This is the result of the pre-process operation:

# 1 "c_core.idl"
# 1 "c_types.idl" 1
typedef unsigned short  ushort;
typedef unsigned long   ulong;
# 8 "c_core.idl" 2
module Mod
{
# 1 "c_base.idl" 1
# 13 "c_base.idl"
interface Consumer;
# 13 "c_core.idl" 2
interface Consumer
{
    void    disconnect_consumer         ();
};
};  


The command is essentially:

omniidl -bcxx -v -WbBOA -T -Wbs=.cc -Wbh=.hh c_base.idl


Real compilable files that demonstrate the problem are attached. 
c_core.idl is the file to compile.

Any ideas? Have I missed the obvious here?

Dietmar


-------------- next part --------------
#ifndef c_types_idl
#define c_types_idl

#define MOD_INCLUDED

typedef unsigned short  ushort;
typedef unsigned long   ulong;

#endif

-------------- next part --------------
#ifndef c_base_idl
#define c_base_idl

#ifndef MOD_INCLUDED
#define MOD_INCLUDED
#define C_BASE_IDL

#include "c_types.idl"

module Mod
{

#endif /*** MOD_INCLUDED ***/

interface Consumer;

#ifdef C_BASE_IDL
#undef MOD_INCLUDED
#endif

#ifndef MOD_INCLUDED
}; /*** end module Mod ***/
#endif

#endif

-------------- next part --------------
#ifndef c_core_idl
#define c_core_idl

#ifndef MOD_INCLUDED
#define MOD_INCLUDED
#define C_CORE_IDL

#include "c_types.idl"

module Mod
{

#include "c_base.idl"

#endif /*** MOD_INCLUDED ***/

interface Consumer
{
    void    disconnect_consumer         ();
};

#ifdef C_CORE_IDL
#undef MOD_INCLUDED
#endif

#ifndef MOD_INCLUDED
}; /*** end module Mod ***/
#endif

#endif



More information about the omniORB-list mailing list