[omniORB] CosNaming.h and ORB portability
Duncan Grisby
duncan at grisby.org
Fri Mar 9 15:34:09 GMT 2007
On Tuesday 6 March, "Brian Neal" wrote:
[...]
> We noticed this in omniORB's CORBA.h:
>
> ---snip---
> // OMG COS IDLs refer to CosNaming IDL as "CosNaming.idl".
> // omniORB uses the file name "Naming.idl". Any IDLs that include
> // CosNaming.idl will have in their stubs #include "CosNaming.hh".
> // Define the external guard for CosNaming to stop include to have
> // any effect. This works because the stub generated by omniidl
> // put external guards around the include.
>
> #ifndef __CosNaming_hh_EXTERNAL_GUARD__
> #define __CosNaming_hh_EXTERNAL_GUARD__
> #endif
> ---snip---
>
> However, our omniidl translator generates #include guards of the form:
>
> #ifndef __CosNaming_hh__
> #define __CosNaming_hh__
>
> So it looks like omniORB tried to solve this problem for us, but the
> include guards are different so it doesn't work. Did omniidl at one
> time generate __CosNaming_hh_EXTERNAL_GUARD__ as the include guard
> name? Or can we configure it to do so somehow?
The external guard is used when one IDL file #includes another. So if
foo.idl does #include <CosNaming.idl> then foo.hh contains:
#ifndef __CosNaming_hh_EXTERNAL_GUARD__
#define __CosNaming_hh_EXTERNAL_GUARD__
#include <CosNaming.hh>
#endif
So, the external guard stuff does serve a useful purpose, just not the
one you want.
> I suppose we could add a -D__CosNaming_hh__ on our compiler command
> line when building for omniORB. We were just curious what others would
> recommend.
That seems like a sensible work-around to me. I've added a #define to
CORBA.h so it defines __CosNaming_hh__, which should avoid this problem.
Cheers,
Duncan.
--
-- Duncan Grisby --
-- duncan at grisby.org --
-- http://www.grisby.org --
More information about the omniORB-list
mailing list