[CORBA] C++ Language Mapping

M

Mario Viertel

Hi,

I have a Problem with the following Code:

//IDL
typedef sequence<float> FloatSeq;

struct MyStruct {
FloatSeq fs;
};


//C++
MyStruct_var myStruct;

FloatSeq_var fs = new FloatSeq;
fs->length(5);
for(CORBA::ULong i=0; i<fs->length(); i++) {
fs = 4711.0 / (i+1);
}

myStruct->fs = fs;


At runtime the program interrupts after the loop.

My question: How can I assign the local 'fs' variable to the structure
'fs' variable?

TIA
Mario
 
S

Shiju Rajan

Hi Mario,

One mistake is that instead of

myStruct->fs = fs;

do something like

myStruct->fs = CORBA::duplicate (fs);

currently fs is only present in the local scope and will be destroyed as
soon as the scope ends.

Thanks,
Shiju,
HP-ISO
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top