[omniORB] sequence problem / beginner

Lars von Wedel vonWedel@lfpt.rwth-aachen.de
Wed, 04 Apr 2001 14:05:00 +0200


This is a multi-part message in MIME format.
--------------C2A50CB1CAB44DFA5F358AD5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


Salut,

> the server side is :
> 
> - jumboExt.cpp
> 
> structure* jumboExt :: iXSGetData() {
> 
>      tmp->length( 100 );
>      for( int i=0; i < 100; i++ ) {
>           tmp[i] = i;
>      };
> 
>      tmp = &temp;
> //   return tmp._retn();
>      return tmp.out();
> };

You neither define tmp nor temp so its difficult to spot where the
actual problem
is. You should be able to do however:

> structure* jumboExt :: iXSGetData() {
>
       structure_var tmp = new structure();
 
>      tmp->length( 100 );
>      for( int i=0; i < 100; i++ ) {
>           tmp[i] = i;
>      };
> 
       return tmp._retn();
> };

>      structure     *data;
To be CORBA-compliant you'd rather write

       structure_var data;

>      data = handler->iXSGetData();
> 
> } catch ( CORBA :: Exception & ) {
> 
>      cout << "Exception";          // This exception was thrown
> 
> };

Probably due to some memory management problem in the server
because the sequence wasn't allocated properly. The book on
'Advanced CORBA programming with C++' by Henning/Vinoskit has
a good explaination of the memory management issues when using CORBA.

Lars
--------------C2A50CB1CAB44DFA5F358AD5
Content-Type: text/x-vcard; charset=us-ascii;
 name="vonWedel.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Lars von Wedel
Content-Disposition: attachment;
 filename="vonWedel.vcf"

begin:vcard 
n:von Wedel;Lars
tel;cell:++49 172 2043412
tel;fax:++49 241 8888326
tel;work:++49 241 805240
x-mozilla-html:TRUE
url:http://www.lfpt.rwth-aachen.de/Staff/vonwedel.html
org:RWTH Aachen;Lehrstuhl fuer Prozesstechnik
adr:;;Turmstrasse 46;52056 Aachen;;;
version:2.1
email;internet:vonWedel@lfpt.rwth-aachen.de
end:vcard

--------------C2A50CB1CAB44DFA5F358AD5--