Re: CORBA_any's



On Sun, 2001-11-04 at 23:18, Michael Meeks wrote:
> 
> Hi Rodrigo,
> 
> On 3 Nov 2001, Rodrigo Moya wrote:
> > typedef CORBA_any GdaValue;
> >
> > GdaValue *gda_value_new (void);
> > gchar    *gda_value_get_string (GdaValue *value);
> > void      gda_value_set_string (GdaValue *value, const gchar *str);
> > void      gda_value_set_integer (GdaValue *value, gint i);
> > ...
> >
> > What I'm trying to do is to have a CORBA_any whose CORBA_TypeCode and
> > value can be changed on the fly. So, in gda_value_set_string I do:
> >
> >       CORBA_Object_release ((CORBA_Object) value->_type, NULL);
> >
> >       value->_type = (CORBA_TypeCode) CORBA_Object_duplicate (
> >               (CORBA_Object) TC_CORBA_string, NULL);
> >       BONOBO_ARG_SET_STRING (value, val);
> 
>         Um ! ? how do you create the Any ? bonobo_arg_new ? I would use:
> 
no, I create it with:

value = GNOME_Database_Value__alloc ();

in the IDL:

	typedef any Value;

>         char *foo = "My String";
> 
>         bonobo_arg_new_from (TC_CORBA_string, &foo);
> 
hmm, yes, but as I said, I create the CORBA_any's, and then, I set the
type and value with the _set_... functions.

If the code looks fine to you, it may be some memory corruption in
another place. I didn't think about it since the code is really really
simple.

Thanks Michael

cheers
-- 
Rodrigo Moya <rodrigo gnome-db org> - <rodrigo ximian com>
http://www.gnome-db.org/ - http://www.ximian.com/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]