[omniORB] Sequence of Sequence causes client compiler errors!!!

Sai-Lai Lo S.Lo@orl.co.uk
28 Jan 1999 19:07:35 +0000


>>>>> David Morgenlender writes:

> .IDL
> ----

>   typedef sequence<long> SingleTestResultsList;
>   typedef sequence<SingleTestResultsList> TestResultsList;
>   void Test(out TestResultsList listTestResults);
	
> Calling code in client
> ----------------------

>   Tests::TestResultsList seqResults;
	
INTERFACE_TESTS-> Test(&seqResults);		// also tried without the "&"
  
> COMPILER ERROR
> --------------  

> error C2664: 'Test' : cannot convert parameter 1 from 
> 'class _CORBA_Unbounded_Sequence<
>   class _CORBA_Unbounded_Sequence_w_FixSizeElement<long,4,4>> *' 
> to 'class _CORBA_Sequence_OUT_arg<class _CORBA_Unbounded_Sequence<
>   class _CORBA_Unbounded_Sequence_w_FixSizeElement<long,4,4>>,
>   class _CORBA_Sequence_Var<class _CORBA_Unbounded_Sequence<
>   class _CORBA_Unbounded_Sequence_w_FixSizeElement<long,4,4>>,
>   class _CORBA_Unbounded_Sequence_w_FixSizeElement<long,4,4>>>'


> Any idea what's going on???

This is a quick one.

The signature of the argument expected is TestResultsList*&. It expects you
to pass a TestResultsList* and on return a sequence is allocated on the
heap by the callee and its pointer is written into your argument.

Try this:

Tests::TestResultsList* seqResults;

INTERFACE_TESTS-> Test(seqResults);

// Remember to free the sequence later.
// Or define seqResults as Tests::TestResultsList_var.

As to why the this is so, check the C++ mapping spec Table 24.

Sai-Lai


-- 
Dr. Sai-Lai Lo                          |       Research Scientist
                                        |
E-mail:         S.Lo@orl.co.uk          |       Olivetti & Oracle Research Lab
                                        |       24a Trumpington Street
Tel:            +44 223 343000          |       Cambridge CB2 1QA
Fax:            +44 223 313542          |       ENGLAND