[omniORB] Can't compile client that retrieves a structwhichcontains a sequence

Tom O'Reilly oreilly at mbari.org
Thu May 1 14:14:22 BST 2008


Ah, I see now.
The server implementation must allocate a SequenceTestIF::Message on the heap (using new operator), since the CORBA framework will automatically try to delete it after the function call is complete - right?

Thanks,
Tom

  ----- Original Message ----- 
  From: Tom O'Reilly 
  To: Luke Deller 
  Cc: omniorb-list at omniorb-support.com 
  Sent: Thursday, May 01, 2008 11:45 AM
  Subject: Re: [omniORB] Can't compile client that retrieves a structwhichcontains a sequence



  > So you don't actually construct a Message_out instance explicitly.  Basically you want to pass a reference to a 
  > pointer, so that the function can point your pointer at the returned message:
  >
  >
  >    SequenceTestIF::Message *msgptr;
  >    seqTest->getMessage(msgptr);
  >    // now you can use msgptr->body
  >    seqTest->setMessage(*msgptr);
  >    delete msgptr;

  OK, but I'm still a bit confused. What does the server implementation code do with the passed-in msgptr, which is null (it IS null to start with, right?)  Is it something like this:

    Server code:

     class SequenceTestServer {

       void getMessage(SequenceTestIF::Message *msg() {
          msg = &_message;
          return;       // Server encounters seg-fault after return statement.
       }

       // Define a Message member
       SequenceTestIF::Message _message;
     };



  I tried something like this, but the server gets a segmentation fault after returning from getMessage().

  Many thanks,
  Tom



------------------------------------------------------------------------------


  _______________________________________________
  omniORB-list mailing list
  omniORB-list at omniorb-support.com
  http://www.omniorb-support.com/mailman/listinfo/omniorb-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20080501/59aca04d/attachment.htm


More information about the omniORB-list mailing list