<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16608" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Ah, I see now.</FONT></DIV>
<DIV><FONT face=Arial size=2>The server implementation must allocate a
SequenceTestIF::Message on the heap (using new operator), since the CORBA
framework will automatically try to delete it after the function call is
complete - right?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks,</FONT></DIV>
<DIV><FONT face=Arial size=2>Tom</FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=oreilly@mbari.org href="mailto:oreilly@mbari.org">Tom O'Reilly</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=ldeller@iress.com.au
href="mailto:ldeller@iress.com.au">Luke Deller</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Cc:</B> <A
title=omniorb-list@omniorb-support.com
href="mailto:omniorb-list@omniorb-support.com">omniorb-list@omniorb-support.com</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, May 01, 2008 11:45
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [omniORB] Can't compile
client that retrieves a structwhichcontains a sequence</DIV>
<DIV><BR></DIV>
<DIV><BR><FONT face=Arial size=2>> So you don't actually construct a
Message_out instance explicitly. Basically you want to pass a reference
to a </FONT></DIV>
<DIV><FONT face=Arial size=2>> pointer, so that the function can point your
pointer at the returned message:</FONT></DIV>
<DIV><FONT face=Arial size=2>><BR>><BR>>
SequenceTestIF::Message *msgptr;<BR>>
seqTest->getMessage(msgptr);<BR>> // now you can use
msgptr->body<BR>>
seqTest->setMessage(*msgptr);<BR>> delete
msgptr;<BR><BR>OK, but I'm still a bit confused. What does the server
implementation code do with the passed-in msgptr, which is null (it IS null to
start with, right?) Is it something like this:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> Server code:</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> class SequenceTestServer
{</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> void
getMessage(SequenceTestIF::Message *msg() {</FONT></DIV>
<DIV><FONT face="Courier New"
size=2> msg =
&_message;</FONT></DIV>
<DIV><FONT face="Courier New"
size=2>
return; <FONT color=#ff0000>// Server
encounters seg-fault after return statement.</FONT></FONT></DIV>
<DIV><FONT face="Courier New" size=2> }</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> // Define a
Message member</FONT></DIV>
<DIV><FONT face="Courier New" size=2>
SequenceTestIF::Message _message;</FONT></DIV>
<DIV><FONT face="Courier New" size=2> };</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I tried something like this, but the server gets
a segmentation fault after returning from getMessage().</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Many thanks,</FONT></DIV>
<DIV><FONT face=Arial size=2>Tom</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>omniORB-list mailing
list<BR>omniORB-list@omniorb-support.com<BR>http://www.omniorb-support.com/mailman/listinfo/omniorb-list<BR></BLOCKQUOTE></BODY></HTML>