AW: [omniORB] fixed-length structs

Wernke zur Borg wernke.zur.borg at vega.de
Wed Jul 11 16:13:42 BST 2007


I am only wondering why the IDL compiler has generated the wrong function signature... ;-)

Just a hint: Always use the -Wbexample option of omniidl to generate your function skeletons. This prevents you from mistyping the signatures.

Wernke


> -----Original Message-----
> From: omniorb-list-bounces at omniorb-support.com 
> [mailto:omniorb-list-bounces at omniorb-support.com] On Behalf 
> Of Sean Parker
> Sent: 11 July 2007 13:50
> To: Fischer, Clemens; omniorb-list at omniorb-support.com
> Subject: Re: AW: [omniORB] fixed-length structs 
> 
> 
> Thanks so much - I'll try it...
> 
>   Sean
> 
> --- "Fischer, Clemens"
> <clemens.fischer at atlas-elektronik.com> wrote:
> 
> > Hi,
> > 
> > the difference in fixed-length and variable-length
> > structs is that the former ones are returned by value,
> > not by pointer. Yet another of the thousand pitfalls in
> > the IDL to C++ mapping.
> > 
> > In case your get() method is an implemetatation of a
> > CORBA interface method, the correct signature would be
> > DateTime get( <stuff> ). It's also not necessary to
> > create a DateTime instance on the heap. You can simply do
> > it like this:
> > 
> >   DateTime get( <stuff> )
> >   {
> >     DateTime ret;
> >     ret.year = 2007;
> >     ...
> >     ret.seconds = 0;
> >     return ret;
> >   }
> > 
> > So you don't need the _var type at all. I guess it's only
> > there for symmetry and in case you later want to make the
> > struct variable-length without changing your code.
> > 
> > If you take a look at _CORBA_ConstrType_Fix_Var, you'll
> > notice that it handles its content by value instead of
> > pointer and immediately deletes the value passed as
> > pointer to its contructor.
> > 
> > Kind Regards
> > Clemens Fischer
> > 
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: omniorb-list-bounces at omniorb-support.com
> > [mailto:omniorb-list-bounces at omniorb-support.com] Im
> > Auftrag von Sean Parker
> > Gesendet: Mittwoch, 11. Juli 2007 02:08
> > Betreff: [omniORB] fixed-length structs 
> > 
> > Hello -
> > 
> >   I've encountered an issue simply because I'm trying to
> > use a struct for the first that is "fixed length" (i.e.
> > it's a series of longs, w/o a string in it)
> > 
> >   For example, I define a struct:
> > 
> > [Begin IDL]
> >   struct DateTime
> >   {
> >     long year;
> >     ...
> >     long seconds;
> >   };
> > [End IDL]
> > 
> >   This results in C++ template using the *_Fix_* class (I
> > forget the exact name) as opposed to the *_Variable_*
> > template class if the struct had a string in it.
> > 
> > [Begin C++]
> >   DateTime* get( <stuff> )
> >   {
> >     DateTime_var ret = new DateTime();
> >     ret->year = 2007;
> >     ...
> >     ret->seconds = 0;
> >     return ret._retn();
> >   }
> > [End C++]
> > 
> >   Now the compile complains "can't convert DateTime to
> > DateTime* in return" on return line.
> >  
> >  I never had this problem when the template class was for
> > variable-length structs. Am I doing something wrong?
> > 
> >  Any assistance appreciated.
> > 
> >   Thanks and God Bless
> >     Sean
> > 



More information about the omniORB-list mailing list