Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[tao-users] Trying to migrate old TAO 1.4.4 code to 2.0.1 on Ubuntu 12.04 64bit

15 views
Skip to first unread message

Steve Prior

unread,
Nov 5, 2012, 10:36:07 PM11/5/12
to tao-...@list.isis.vanderbilt.edu
I'm having trouble porting some old ACE/TAO code to a new system running Ubunti
12.02 64 bit with TAO 2.0.1.

using the following IDL:

module Smrthm
{
interface Video {
typedef sequence<octet> Picture;
Picture TakeSnapshot();
};
};

The following code coredumps in the memcpy:

Smrthm::Video::Picture_var theSnapshot = video->TakeSnapshot();
long pictureLength = theSnapshot->length();
cerr << "allocating buffer of size:" << pictureLength << "\n";
void *buffer = malloc(pictureLength);
cerr << "allocated buffer\n";
memcpy(buffer, theSnapshot->get_buffer(1), pictureLength);
cerr << "memcpy complete\n";

So I suspect I'm doing something wrong around theSnapshot->get_buffer(1), but
I'm not sure what. Can someone point me to an example of how you're supposed to
access the data of a sequence<octet>?

Thanks
Steve

Adam Mitz

unread,
Nov 6, 2012, 12:14:22 AM11/6/12
to tao-...@list.isis.vanderbilt.edu
Hi Steve,

On 11/5/2012 9:36 PM, Steve Prior wrote:
> I'm having trouble porting some old ACE/TAO code to a new system running Ubuntu
> 12.02 64 bit with TAO 2.0.1.
>
> using the following IDL:
>
> module Smrthm
> {
> interface Video {
> typedef sequence<octet> Picture;
> Picture TakeSnapshot();
> };
> };
>
> The following code coredumps in the memcpy:
>
> Smrthm::Video::Picture_var theSnapshot = video->TakeSnapshot();
> long pictureLength = theSnapshot->length();
> cerr << "allocating buffer of size:" << pictureLength << "\n";
> void *buffer = malloc(pictureLength);
> cerr << "allocated buffer\n";
> memcpy(buffer, theSnapshot->get_buffer(1), pictureLength);
> cerr << "memcpy complete\n";
>
> So I suspect I'm doing something wrong around theSnapshot->get_buffer(1), but
> I'm not sure what. Can someone point me to an example of how you're supposed to
> access the data of a sequence<octet>?


I don't know of any reason to pass 1 (actually, "true") as the argument
to get_buffer(1) for this read-only use case. Instead just let the
default parameter take effect and call get_buffer().

Thanks,
Adam Mitz
Senior Software Engineer
Object Computing, Inc.

0 new messages