[omniORB] Callback problem

Duncan Grisby dgrisby@uk.research.att.com
Fri, 16 Feb 2001 15:34:15 +0000


On Friday 16 February, Andrew Parkin wrote:

> /** IMPLEMENTATION OF CorbaRemoteSMListener */
> class CorbaRemoteSMListenerImpl: sms::_impl_CorbaRemoteSMListener

You should never derive from the _impl class. It's an internal omniORB
specific thing. You should derive your servant class from
POA_sms::CorbaRemoteSMListener.

> /** CODE TO PASS THE CALLBACK */
> CorbaRemoteSMListenerImpl* corbaRemoteSMListenerImpl = new
> CorbaRemoteSMListenerImpl();
> CORBA::String_var ticketID = e->submitMessageGetEvents(msgStruct,
> (sms::_objref_CorbaRemoteSMListener*)corbaRemoteSMListenerImpl);

As Stefan has already posted, code which has to subvert the C++ type
system is usually wrong. This code certainly is. You should use the
proper POA functions.

I strongly recommend that you study the omniORB example programs, and
get hold of a good book on the CORBA C++ mapping. "Advanced CORBA
Programming with C++" by Henning and Vinoski is the best bet. Don't be
put off by the "Advanced" in the title -- it starts out with the
basics.

Cheers,

Duncan.

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