[omniORB] Can't compile client that retrievesastructwhichcontains
a sequence
William Bauder
bill at simplified.biz
Fri May 2 13:42:15 BST 2008
Make that *msg=message - I'm not paying attention either..
-----Original Message-----
From: omniorb-list-bounces at omniorb-support.com
[mailto:omniorb-list-bounces at omniorb-support.com] On Behalf Of William
Bauder
Sent: Friday, May 02, 2008 11:48 AM
To: 'Tom O'Reilly'; 'Luke Deller'
Cc: omniorb-list at omniorb-support.com
Subject: RE: [omniORB] Can't compile client that
retrievesastructwhichcontains a sequence
Look closely at the code - you're not actually returning anything (you
need *msg=&_message). You should still use the Message_out as the
parameter type, instead of Message* - you'll have less heartache down
the road.
To the best of my knowledge, only the _var and _ptr types deal with
memory management - I believe that the _out stores a copy of what you
give it, but I'm not an expert in this area by any stretch of the
imagination. What you are doing should be fine as long as you return
something (assuming that you've initialized all of _message's members
somewhere).
-Bill
-----Original Message-----
From: omniorb-list-bounces at omniorb-support.com
[mailto:omniorb-list-bounces at omniorb-support.com] On Behalf Of Tom
O'Reilly
Sent: Thursday, May 01, 2008 4:14 PM
To: Tom O'Reilly; Luke Deller
Cc: omniorb-list at omniorb-support.com
Subject: Re: [omniORB] Can't compile client that retrieves
astructwhichcontains a sequence
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 <mailto:oreilly at mbari.org> O'Reilly
To: Luke Deller <mailto:ldeller at iress.com.au>
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/20080502/73fedb3c/attachment.htm
More information about the omniORB-list
mailing list