[omniORB] Reopening namespace - the complete solution

Alex Shabarshoff shura@uc.ru
Fri, 18 Feb 2000 10:20:51 +0300


David Bryant wrote:

> I have developed some stuff under Linux which I am now trying to port to
> IRIX. The problem is that the same IDL files will not compile under
> IRIX. There seems to be a problem with "re-opening modules". OmniORB
> 2.8.0 is installed on both systems.

And David Riddoch answers:

>omniidl2 allows re-opening of modules by default on some platforms which
>are known to have namespaces.  On other platforms you have to pass the -m
>option.

This solves the problem in C++ with namespaces, but if you don't have
namespaces or use Sun's idl2java compiler you must use something else.
To solve this problem i'm use this technique:

Add the following to idl file (assuming file is Arbiter.idl and
namespace PSIT):

#ifndef Arbiter_idl
#define Arbiter_idl

#ifndef NAMESPACE_OPENED
#define NAMESPACE_OPENED
#define NAMESPACE_ROOT_Arbiter
module PSIT { // here namespace begins
#endif

// some more such includes goes here
#include "Authentificator.idl"

... // the interface defineitions here

#ifdef NAMESPACE_ROOT_Arbiter
}; // here namespace ends
#endif
#endif

This works fine even with Sun's idl2java.

Best regards,  
  Alex Shabarshoff (mailto:shura@uc.ru)

Union Card Processing Company
Chief of Security Systems Development Department
Europay Security Supervisor