Re: CORBA_free() question



A Ter, 2003-05-27 às 16:32, Chris Wareham escreveu:
> I have a utility function which returns an object reference by looking
> it up in the Naming service. I'm just wondering of I need to call
> CORBA_free() on the id and kind fields of the NameComponent. The OMG
> mapping docs are a little bit light on information like that, and I
> can't find any "real world" examples.

   I would say: definitely.  But don't CORBA_free anything that is
statically allocated: name and name_components.

> 
>                               -oOo-
> 
> CosNaming_NamingContext naming_context;
> 
> CORBA_Object
> get_object(const char *id, const char *kind)
> {
>      CosNaming_NameComponent name_components[1];
>      CosNaming_Name name = { 1, 1, name_components, CORBA_FALSE };
>      CORBA_Environment ev;
>      CORBA_Object obj;
> 
>      name_components[0].id = CORBA_string_dup(id);
>      name_components[0].kind = CORBA_string_dup(kind);
> 
>      CORBA_exception_init(&ev);
> 
>      obj = CosNaming_NamingContext_resolve(naming_context, &name, &ev);
> 
>      CORBA_exception_free(&ev);
> 
>      return obj;
> }
> 
>                               -oOo-
> 
> Chris
-- 
Gustavo João Alves Marques Carneiro
<gjc@inescporto.pt> <gustavo@users.sourceforge.net>





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