[omniORB] Is this possible?
Sai-Lai Lo
S.Lo@orl.co.uk
Wed, 25 Mar 1998 16:25:51 GMT
I'm not sure I understand what you are trying to do. It seems that you are
subverting the type system with pointer manipulations. Something that I
always try to avoid...
>>>>> Bing Zhang writes:
> 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