[omniORB] strings parameters passing rules.
jorgefm at cirsa.com
jorgefm at cirsa.com
Wed Oct 8 11:16:48 BST 2003
Hi all !
After reading 'Advanced CORBA programming with C++' i have some questions
about
passing strings from a client to the server.
With the idl file:
struct Vls {
long l_mem;
string s_mem;
};
interface Foo {
Vls vls_op( in Vls vls_in, inout Vls vls_inout, out Vls vls_out ) ;
};
If i have a method:
void my_func( const char *str_in, char *str_inout )
{
Foo_var fv = ...; // Get reference
Vls in_val;
Vls inout_val;
Vls *out_val;
Vls *ret_val;
in_val.l_mem = 99;
1) in_val.s_mem = str_in;
2) in_val.s_mem = CORBA::string_dup( str_in );
inout_val.l_mem = 99;
inout_val.s_mem = CORBA::string_dup( str_inout );
ret_val = fv->vls_op( in_val, inout_val, out_val );
3) CORBA::string_free( in_val.s_mem );
4) str_inout = inout_val.s_mem;
...
If i put 2) then i have to put 3).
My questions are:
The 1) is correct ? or always i have to do 2)
And what about 4) ? Who have to free this resource ?
Any comment is welcome !
Thanks in advance,
Jorge
________________________________________________________________________________
Este mensaje se dirige exclusivamente a su destinatario y puede contener
información CONFIDENCIAL sometida a secreto profesional o cuya divulgación
esté prohibida en virtud de la legislación vigente. Si ha recibido este
mensaje por error, le rogamos que nos lo comunique inmediatamente por esta
misma vía o por teléfono (34 93 739 67 00) y proceda a su destrucción.
Nótese que el correo electrónico vía Internet no permite asegurar ni la
confidencialidad de los mensajes que se transmiten ni la correcta recepción
de los mismos. En el caso de que el destinatario de este mensaje no
consintiera la utilización del correo electrónico vía Internet, rogamos lo
ponga en nuestro conocimiento de manera inmediata. This message is
intended exclusively for its addressee and may contain information that is
CONFIDENTIAL and protected by a professional privilege or which disclosure
is prohibited by law. If this message has been received in error, please
immediately notify us via e-mail or by telephone (34 93 739 67 00) and
delete it. Please note that Internet e-mail does not guarantee the
confidentiality or the proper receipt of the messages sent. If the
addressee of this message does not consent to the use of Internet e-mail,
please communicate it to us immediately.
_________________________________________________________________________________
More information about the omniORB-list
mailing list