[omniORB] problem when passing an interface in a function

Edward Lin edwardlin.tw at gmail.com
Fri Jan 22 11:41:18 GMT 2010


Hi,

You've to be aware of CORBA memory marshaling, I guess it should be

CORBA::String_var p = obj->name();


2010/1/21 risc risc <riscman77 at gmail.com>:
> Thanks Edward,
>
> i see the problem but i have the problem also if i have this function:
>
>   void inter2::getName( prova::inter_ptr obj )
>   {
>   char *p=obj->name();
>
>   cout<<p<<endl;
>   }
>
>
> 2010/1/21 Edward Lin <edwardlin.tw at gmail.com>
>>
>> Hi,
>>
>> At least I see one problem, you cannot "return p"; you must
>>
>> char* inter2::getName( ... )
>> {
>>    ...
>>    return CORBA::string_dup(p);
>> }
>>
>> You can refer to omniORB 'echo' example.
>>
>> >> server:
>> >>
>> >> char * inter2::getName( prova::inter_ptr obj )
>> >> {
>> >>  char *p=obj->name();
>> >>
>> >>  cout<<p<<endl
>> >>
>> >> return p;
>> >> }
>
>



More information about the omniORB-list mailing list