On Thu, Aug 23, 2012 at 04:02:09PM -0400, Rafael Schloming wrote:
> I'm a little confused by what you're trying to do with the wrapper. This is
> what I have for the wrapper in my ruby.i:
> int pn_message_save(pn_message_t *msg, char *OUTPUT, size_t *OUTPUT_SIZE);
> %ignore pn_message_save;

With the above the error happens at 65 characters. I took out my wrapper
and ran the test again and it crashes at 65 characters every time.
> I believe this is all that is necessary since the standard typemaps should
> pick up on OUTPUT and OUTPUT_SIZE and just do the right thing.

What I would like to see in the dynamic languages for this is to not
even have to specify the size for the output buffer; i.e., just call:


and get the data back as one lump.

> Regardless, I think the cause for the issue is that your wrapper function
> is assuming pn_message_save returns a signed size, but actually it returns
> an int that is 0 on success or an error code on failure:
>   int pn_message_save(pn_message_t *message, char *data, size_t *size);
> On success the size of the output data is stored into *size. (I'll add some
> API-doc for this.)
> As an aside in looking at this I noticed that there is some duplication
> between the php, ruby, and python files that could be consolidated into the
> cproton.i. I think this particular declaration is part of that duplication
> unless there is some reason I'm missing that it has to be different for
> ruby.

Agreed. Also, we should make sure to remove having the individual
languages include them relatively (i.e., %include "../cproton.i") and
instead place the shared files in the include directory.

Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.

Attachment: pgp6ttzGRxBm0.pgp
Description: PGP signature

Reply via email to