<span class="gmail_quote"><br></span><div style="direction: ltr;">Hello,<br>
I tried the "any" type, but I did not manage to get it work.<br>
Thanks for the reply, I found my solution. (Exactly not me, a friend of mine)<br>
I write it down, maybe it is helpful for someone else, as I found more questions about this.<br>
My real problem was the glibc, wanted to free invalid pointer.<br>
#idl<br>
struct MyStruct{<br>
string str;<br>
long num;<br>
}<br>
interface MyData{<br>
void get(out MyStruct s_data);<br>
};<br>
<br>
In a method I tried to to pass it to the out_arg as reference.<br>
MyStruct myStruct;<br>
...<br>
s_data=&myStruct;<br>
<br>
After this, the client got myStruct, it can read all the fields, but server got <br>
*** glibc detected *** free(): invalid pointer: 0x081443c4 ***<br>
Maybe it wants to free s_data, but myStruct should not be freed.<br>
<br>
The solution was, to allocate mem for s_data, and not just let it initialized.<br>
s_data=new MyStruct();<br>
In this case I can copy the fields one by one.<br>
Another, faster solution is to pass it immediatelly,<br>
s_data=new MyStruct(myStruct);<br>
<br>
And it seems to work pretty fine, and I do not need "any" or anything else.<br>
Thanks, anyway,<br></div><div style="direction: ltr;"><span class="sg">
Attila</span></div><div style="direction: ltr;"><span class="e" id="q_10acb44c68e65c6f_2"><br>
<br>
<br><div><span class="gmail_quote">On 4/24/06, <b class="gmail_sendername">Dominguez, Jose Luis</b> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="direction: ltr;">
<div align="left" dir="ltr"><span><font color="#0000ff" face="Arial" size="2">I think that if you use char * instead of of string would
work fine.</font></span></div>
<div align="left" dir="ltr"><span><font color="#0000ff" face="Arial" size="2">to get char * from string, you can use c_str() function
from string class.</font></span></div>
<div align="left" dir="ltr"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div align="left" dir="ltr"><span><font color="#0000ff" face="Arial" size="2">If you use type "any", i don't remember how it works, but
you can use operator "<<" to insert and ">>" to
extract.</font></span></div>
<div align="left" dir="ltr"><span><font color="#0000ff" face="Arial" size="2">Some distributions have some errors with "any" types. But
with strings there is no matter.</font></span></div>
<div align="left" dir="ltr"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div align="left" dir="ltr"><span><font color="#0000ff" face="Arial" size="2">value-> contains data</font></span></div>
<div align="left" dir="ltr"><span><font color="#0000ff" face="Arial" size="2">type-> contains a number to identify the type of data it
contains.</font></span></div>
<div align="left" dir="ltr"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div align="left" dir="ltr"><span><font color="#0000ff" face="Arial" size="2">Not quite sure of all this but hope it would be
usefull.</font></span></div>
<div align="left" dir="ltr"><span><font color="#0000ff" face="Arial" size="2">Jose</font></span></div>
<div align="left" dir="ltr"><span></span> </div><br>
<div align="left" dir="ltr" lang="en-us">
<hr>
<font face="Tahoma" size="2"><b>From:</b> <a href="mailto:omniorb-list-bounces@omniorb-support.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">omniorb-list-bounces@omniorb-support.com</a>
[mailto:<a href="mailto:omniorb-list-bounces@omniorb-support.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">omniorb-list-bounces@omniorb-support.com</a>] <b>On Behalf Of </b>Attila
Czigány<br><b>Sent:</b> domingo, 23 de abril de 2006 19:46<br><b>To:</b>
<a href="mailto:omniorb-list@omniorb-support.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">omniorb-list@omniorb-support.com</a><br><b>Subject:</b> [omniORB] String in
struct<br></font><br></div></div><div style="direction: ltr;"><span>
<div></div>Hello,<br>I am new to corba, tried a few things although. I would
like to send a struct back and forth between the client and the server, that
countains a string field, but unfortunatelly I had to realize, that it is not so
easy. It works fine, when the struct contains just numbers.<br>I found the
"typecode" and "any" section in the documentation, but it is not too clear for
me. Could anybody tell me, how can I send such struct? I use omniorb 4.0, and
the c++ binding.<br>Thanks, Attila
</span></div></blockquote></div><br>
</span></div>