[omniORB] Pliiiz help me with my callback-problem

baileyk@schneider.com baileyk@schneider.com
Fri, 5 Apr 2002 12:42:08 -0600



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

This should be

   virtual char* getStatus() {
   return CORBA::string_dup("getStatus");
   }

Generally, if you find yourself casting types, there is likely a more
correct way.  Java requires a lot of casts when dealing with containers and
such, but in C++ one should try to avoid brute force casts.

As someone else pointed out, the String_var type has a method designed for
what you are doing, called _retn().

The C++ mapping spec will give you the definitive reason for the above (or
read the Henning and Vinoski book).  In the case of the string types, there
are very specific rules on how to deal with memory management.  The rules
are rather low level to keep things consistent between the C and C++ CORBA
mappings.

Kendall Bailey