Sequences

Nalin Stefano 308885/IF tikki@dei.unipd.it
Fri, 10 Oct 1997 15:34:25 +0200 (MET DST)


On Fri, 10 Oct 1997, Jvrg Narr wrote:

I'm not very expert but I think that yuo have to set the length of asv
to its actual length. If you define also asv[1] ... asv[4], then you can
do asv->length(5).

Best regards
Stefano

> Hi experts,
> 
> since nobody has any problems out there I hope you are happy to see
> that at least I have a problem:
> 
> I use the following IDL-Code:
> 
> interface CORBAMSG_ValueDef 
> {
>    struct attributes 
> 	{
> 	   string slotname;
>       long flag;
> 	   string value;
> 		string state; 
> 	};
> 
> 	typedef sequence <attributes> attributes_seq;
> 
> 	oneway void update (in attributes_seq as);
> };
> 
> 
> And the following code for initializing and sending the Message:
> 
> CORBAMSG_ValueDef::attributes_seq_var asv;            // in a
> Header-File Class CorbaWrapper
> asv = new CORBAMSG_ValueDef::attributes_seq;          // in the
> Constructur of the C++-File of CorbaWrapper (I have also tried the
> max-len
>                                                       // constructor,
> but it doesn't work, too.)
> 
> asv->length(5);                                       // In a method
> "eingabe" that is input of CorbaWrapper
> 	
> asv[0].slotname  = (const char*) "Slotname";          // I have even
> tried CORBA::string_dup("Slotname");
> asv[0].flag      = 120L;
> asv[0].value     = (const char*) "Value";
> asv[0].state     = (const char*) "State";
> 
> 
> I got a valid Object-Reference, at least CORBA::is_nil(ref) gives back
> true.
> 
> As soon as I use ref->update(asv) though I get a segmentation fault -
> core dump.
> 
> This only happens when asv->length isn't set to 1. As long as it is set
> to 1 it works fine.
> 
> I would appreciate any help since I am getting crazy about this.
> 
> Kind regards,
> 
> Joerg
>