[Ace-users] [tao-users] Is strdup required for return and out parameters

Christian Fromme christian at ast.dfs.de
Thu Oct 18 02:50:38 CDT 2007

On 18.10. 12:22, Vikram Karandikar wrote:
> Now i have one DS which in one IDL i pass as in param and in some other IDL
> i pass it as out param.
> So while passing it as in i don't have to do strdup to assign to
> String_Manager mapped field.

Please see "Advanced CORBA Programming in C++" By Henning/Vinoski,
Chapters 6.10 (The String_var Wrapper Class) and 7.14 (Paramater 
Passing Rules) for information about String handling in CORBA/C++.
Especially 6.10 explains clean-cut how to use Strings here.

Basically the String_var class expects the assigned string to be
allocated via CORBA::string_alloc or CORBA::string_dup. This can lead to
some pitfalls in String-handling, if not taken care for.

Christian Fromme

More information about the Ace-users mailing list