[omniORB] Passing strings to functions

Luke luked@xplantechnology.com
Thu, 6 Dec 2001 17:55:38 +1100 (EST)


On Thu, 6 Dec 2001, Bruce Fountain wrote:

> Note that the returned value is a char*, not a CORBA::String_var. The
> CORBA libraries will free whatever memory your method returns, so you
> have to allocate it on the heap and not clean it up. If you assign the
> result to a _var variable then the associated memory will be cleaned
> up when the local variable goes out of scope. If this code worked with
> ORBacus then you were just lucky.

But David called String_var::_retn(), which yields ownership of the string
to the caller.  So as far as I can see, his code should work..

Luke.