[omniORB] Is this possible?

Bing Zhang bzhang@sohar.com
Tue, 24 Mar 1998 11:03:06 -0800


Maybe this is only a C++ question. I am using VC++ 5.0 on NT 4.0 with
omniORB 2.4.0.

In side the function void GIOP_S::HandleRequest(CORBA::Boolean
byteorder) in file giopServer.cc, there is a piece of code:

  omniObject *obj = 0;
  try {
    obj = omni::locateObject(omniObjectManager::root(),pd_objkey);
    if (!obj->dispatch(*this,(const char
*)pd_operation,pd_response_expected))
        {
         ......
  }

We want to manipulate the pointer obj returned from     obj =
omni::locateObject(omniObjectManager::root(),pd_objkey); , so I set it
to a global variable defined as

omniObject *ptr;

Inside the eg3_impl.cc main(), a call ((Echo_i *) ptr
)->echoString("test"); leads to the destructor of omniObject and
"abnormal termination" is thrown out when it executes assert(0).  I
found out there is a byte difference between orginal Echo_i pointer and
the omniObject pointer.

Echo_i e = new Echo_i();
cerr << "Orginal ponter address is " <<  e << "The casted omniObject
pointer address is " << (omniObject *) e << "The global pointer address
is " << ptr << endl;

The address of (omniObject *) e and ptr are same, but is different from
the address of e.

Am I doing something impossible?

Bing