[omniORB] Need help for memory access violation for unbounded sequence

sanjaymu@mastek.com sanjaymu@mastek.com
Tue, 27 Feb 2001 19:48:08 +0530


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C0A0C8.1B98DC80
Content-Type: text/plain;
	charset="ISO-8859-1"

Hi,
 
I have written simple program based on sequence<>. My sample CORBA component
has one method ReturnAdds() which returns a AddList object which is actually
an unbounded sequence of Address struct. My IDL definition is as follows:

struct Address
{
 string name;
};
 
typedef sequence<Address> AddList;
 
interface TestSequence
{
 AddList ReturnAdds();
};
 

My implementation of ReturnAdds is as follows:

 AddList* TestSequence_i::ReturnAdds()
{
         cout << "TestSequenceImpl::ReturnAdds(): called." << endl;
        AddList* _result;
 
       _result = new AddList(3); // allocate memory
        _result->length(3);
    
     int i = 0;
     (*_result)[i++].name = CORBA::string_dup("Sanjay");
     (*_result)[i++].name = CORBA::string_dup("Shankar");
     (*_result)[i++].name = CORBA::string_dup("Murudkar");
 
        cout << "TestSequenceImpl::ReturnAdds(): returning..." << endl;
        return _result;
}
 

Well I go through my implemented method but the server stub code of the
ReturnAdds() method gives me memory access violation. I feel that the code
which I have written is right one as it works properly on Orbix2000 1.1.
BTW I am using VC++ 6.0 Windows 2000 with VS SP3. Can anybody help me in
finding out what problem I am getting.

Regards, 

Sanjay Murudkar 
Ext. 1493 

 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it.

This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed.

Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.

This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them.

If you have received this e-mail in error, kindly delete this e-mail from all computers and please contact the sender on +91-22-829 0635.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

------_=_NextPart_001_01C0A0C8.1B98DC80
Content-Type: text/html; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3DISO-8859-=
1">


<META content=3D"MSHTML 5.50.4522.1800" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D706375113-27022001>Hi,</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D706375113-27022001></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><SPAN class=3D706375113-27022001>I have wr=
itten=20
simple program based on sequence&lt;&gt;. My sample CORBA component has one=
m
 ethod ReturnAdds() which returns a AddList object which is actually an=20
unbounded sequence of Address struct. My IDL definition is as=20
follows:</SPAN></FONT></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
  <DIV><FONT face=3DArial size=3D2><SPAN class=3D706375113-27022001>struct=
 
  Address<BR>{<BR>&nbsp;string name;<BR>};</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><SPAN class=3D706375113-27022001>typedef=
 
  sequence&lt;Address&gt; AddList;</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><SPAN class=3D706375113-27022001>interfa=
ce=20
  TestSequence<BR>{<BR>&nbsp;AddList ReturnAdds();<BR>};</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2><SPAN=20
  class=3D706375113-27022001></SPAN></FONT>&nbsp;</DIV></BLOCKQUOTE>
<DIV dir=3Dltr><FONT face=3DArial size=3D2><SPAN class=3D706375113-27022001=
>My=20
implementation of ReturnAdds is as follows:</SPAN></FONT></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
  <DIV dir=3Dltr><FONT face=3DArial size=3D2><SPAN=20
  class=3D706375113-27022001>&nbsp;AddList*=20
  TestSequence_i::ReturnAdds()</SPAN></FONT></DIV>
  <DIV dir=3Dltr><FONT face=3DArial size=3D2><SPAN=20
  class=3D706375113-27022001>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
  cout &lt;&lt; "TestSequenceImpl::ReturnAdds(): called." &lt;&lt;=20
  endl;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddList*=20
  _result;</SPAN></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2><SPAN=20
  class=3D706375113-27022001></SPAN></FONT>&nbsp;</DIV>
  <DIV><SPAN class=3D706375113-27022001><FONT face=3DArial=20
  size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _result =3D new AddList(3);=
 //=20
  allocate=20
  memory<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_result-&gt;len=
gth(3);<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int=20
  i =3D 0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(*_result)[i++].name =3D=20
  CORBA::string_dup("Sanjay");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(*_result)[=
i++].name=20
  =3D=20
  CORBA::string_dup("Shankar");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(*_result)=
[i++].name=20
  =3D CORBA::string_dup("Murudkar");</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV dir=3Dltr><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN=
 
  class=3D706375113-27022001>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>cout &lt;&lt;=
 
  "TestSequenceImpl::ReturnAdds(): returning..." &lt;&lt; endl;<BR><SPAN=20
  class=3D706375113-27022001>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>&nbsp;&nbsp;&nb=
sp;=20
  return _result;<BR>}</FONT></DIV>
  <DIV dir=3Dltr></SPAN><SPAN class=3D706375113-27022001><FONT face=3DArial=
 
  size=3D2></FONT></SPAN>&nbsp;</DIV></BLOCKQUOTE>
<DIV dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><SPAN class=3D706375113-27022001=
><FONT=20
face=3DArial size=3D2>Well I go through my implemented method but&nbsp;the =
server=20
stub code of the ReturnAdds() method&nbsp;gives me memory access violation.=
 I=20
feel&nbsp;that the&nbsp;code which I have written is right one as it works=
p
 roperly on Orbix2000 1.1.</FONT></SPAN></DIV>
<DIV dir=3Dltr style=3D"MARGIN-RIGHT: 0px"><SPAN class=3D706375113-27022001=
><FONT=20
face=3DArial size=3D2>BTW I am using VC++ 6.0 Windows 2000 with VS SP3. Can=
 anybody=20
help me in finding out what problem I am getting.</FONT></SPAN></DIV>
<P><FONT face=3DArial size=3D2>Regards,</FONT> </P>
<P><FONT face=3DArial size=3D2>Sanjay Murudkar</FONT> <BR><FONT face=3DAria=
l=20
size=3D2>Ext. 1493</FONT> </P>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV><CODE><FONT SIZE=3D3><B=
R>
<BR>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR>
Opinions expressed in this e-mail are those of the individual and not that =
of Mastek Limited, unless specifically indicated to that effect. Mastek Lim=
ited does not accept any responsibility or liability for it.<BR>
<BR>
This e-mail and attachments (if any) transmitted with it are confidential a=
nd/or privileged and solely for the use of the intended person or entity to=
 which it is addressed.<BR>
<BR>
Any review, re-transmission, dissemination or other use of or taking of any=
 action in reliance upon this information by persons or entities other than=
 the intended recipient is prohibited.<BR>
<BR>
This e-mail and its attachments have been scanned for the presence of compu=
ter viruses. It is the responsibility of the recipient to run the virus che=
ck on e-mails and attachments before opening them.<BR>
<BR>
If you have received this e-mail in error, kindly delete this e-mail from a=
ll computers and please contact the sender on +91-22-829 0635.<BR>
<BR>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR>
</FONT></CODE></BODY></HTML>

------_=_NextPart_001_01C0A0C8.1B98DC80--