[omniORB] error message when compiling a trivial IDL file
Dietmar May
dcmay@object-workshops.com
Tue, 16 Feb 1999 20:53:11 -0500
Fox,
> --------------------------------------
>
> typedef struct tmpstru1_ {
> long j;
> [size_is (j) ] long * x;
> } tmpstru1;
> ---------------------------------------
This is Microsoft COM IDL, NOT CORBA IDL. It won't compile using omniORB,
or any other CORBA implementation. The fact that both CORBA and COM use the
acronym IDL can be confusing.
I believe that for what this structure appears to do, the correct CORBA IDL
is:
typedef sequence<long> LongSeq;
Of course, COM requires much different implementation code than CORBA.
The LongSeq::length() member function provides the equivalent of 'j', and
the LongSeq::operator[] overloaded operator provides the equivalent of
indexing 'x'. Use an IDL-generated _var on the client end to auto-release
the sequence when no longer needed; however, on the server end, CORBA will
release the memory. (Check out the CORBA reference guide in the document
section at http://www.omg.org).
For example, on the server end:
LongSeq* p_seq = new LongSeq;
p_seq->length(3);
p_seq[0] = 4;
p_seq[1] = 12;
p_seq[2] = -7;
return p_seq;
On the client end,
LongSeq_var p_seq = method_call_returning_LongSeq();
long j = p_seq->length();
for(long i = 0; i < j; ++i)
long data = p_seq[i];
Regards,
Dietmar May
Software Architect
Object Workshops, Inc.
dcmay@object-workshops.com