Re: exception question



Hi Ognen,

On Mon, 22 Oct 2001 ognen@gene.pbi.nrc.ca wrote:
> I am new to ORBit so bare with me :) - I have several questions:
>
> 1. I get an exception #2 - tried looking for it through the sources
> but couldnt find it (I get this in the client calling a simple method
> on the server).

        Hmm - it could be a lot of things; perhaps the remote end died, so
you got a CORBA_COMM failure, or somesuch. What does the exception
envirronment say ? what is ev->_repo_id ( or _id in ORBit2 ).

> 2. In my idl I have a typedef<octet> bytes; and later I have bytes
> serialize() ;
>
> Now, if I have a char* and want to put it in Data, can someone show me
> the code to do this? I am just trying to get a hang of it. My guess is
> this:

        You want to use a string for strings; use return CORBA_string_dup
(id_local), however assuming you want a sequence:

> DICE2_Basic_CORBA_bytes *retval;
>
> /* hmmmmm.... lets see if this works */
> retval = NULL;
> retval = malloc(sizeof(struct CORBA_sequence_octet_struct));

        This will crash in the skel; you need to use the ORB allocators so
do:

        retval = CORBA_sequence_octet__alloc ();
        retval->_buffer = CORBA_sequence_octet_allocbuf (
                strlen (id_local));

        memcpy (retval->_buffer, id_local, strlen (id_local));

        then:

> return retval;
>
> Am I completely lost and off track or...? :)

        You just need to understand that the skel needs to free the
structures you build if you invoke an out of proc method - so it needs to
understand the allocation methods you use.

        Regards,

                Michael.

-- 
 mmeeks@gnu.org  <><, Pseudo Engineer, itinerant idiot




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