[omniORB] Pliiiz help me with my callback-problem

charlotte1@pedersen.ms charlotte1@pedersen.ms
5 Apr 2002 17:22:06 -0000


Hi Bjorn (and thank you very, very much.... you saved my day here)

Yepp, I am a java programmer that's for sure. Because I only made a quick test 
implementation of the call-back servant I made a new string for everey call 
trigger:

  virtual char* getStatus() {
  CORBA::String_var ret = (const char*) "getStatus";
  cerr << "getStatus() is triggered from server" << endl;
  cerr << "Value: \"" << (char*)ret <<"\"." << endl;
  return ret;
  }

This worked fine when the method was triggered inside the connect() method of 
the servant (this is the method where I register the callback-object ref.). But 
as soon as the connect method returned, the servant could not recieve a return-
value when the same callback method was triggered. I still think this is a 
little bit strange since I create a new String_var for each time the getStatus
() method is invoked, but I guess it has got something to do with the memory 
managment in c++ ?!?! (Or maybe how the String_var function.. realeasing 
itself??) However when put it this way:

   virtual char* getStatus() {
   return (char*) "getStatus";
   }

everything seems to work... :-)

Again Bjorn, thank you very much for you quick reply 

Regards,

Charlotte