[omniORB] Error while compiling snapshot 20010823 of omniORB4

Duncan Grisby dgrisby@uk.research.att.com
Thu, 23 Aug 2001 11:49:33 +0100


On Thursday 23 August, =?iso-8859-1?Q?Fr=E9d=E9ric_Bouvier?= wrote:

[...]
> ..\omniORB4/bootstrapDynSK.cc(122) : error C2440: '=' : cannot convert from
> 'void (__cdecl *)(const struct omni::tcObjrefDesc *,class CORBA::Object *)'
> to 'void (__cdecl *)(struct omni::tcObjrefDesc *,class CORBA::Object *)'
>         This conversion requires a reinterpret_cast, a C-style cast or
> function-style cast

[...]
> Maybe omniidl has problems while generating stubs ?

Actually, it's the other way around -- the interface and IDL compiler
have been changed to use const, but one of the consts was missing from
the function pointer typedef in tcDescriptor.h. Strangely, gcc
complains (but only with a warning) if the function pointer has a
const argument but the function being assigned doesn't have const, but
it doesn't complain when the function pointer has a non-const
argument, but the function being assigned does.

Anyway, it's fixed now in CVS. The fix is just:

diff -u -r1.2.2.7 tcDescriptor.h
--- include/omniORB4/tcDescriptor.h	2001/08/22 13:29:45	1.2.2.7
+++ include/omniORB4/tcDescriptor.h	2001/08/23 10:47:58
@@ -98,7 +98,7 @@
 // tcObjref //
 //////////////
 
-typedef void (*tcObjrefSetReferenceFn)(tcObjrefDesc*, CORBA::Object_ptr);
+typedef void (*tcObjrefSetReferenceFn)(const tcObjrefDesc*, CORBA::Object_ptr);
 
 typedef CORBA::Object_ptr (*tcObjrefGetReferenceFn)(const tcObjrefDesc*);
 

Thanks for pointing the problem out,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --