Subject: [ruby-ffi] Re: How to specify size for returned buffer? |
From: cfis |
Date: 8/20/11 6:17 PM |
To: ruby-ffi |
On Aug 20, 1:59 am, przemo_li <an.prze...@gmail.com> wrote:
Why do you need "buffer" having ".size". Cant you pack both variables into class instance that do "anything" you want buffer to do?
Reading the ruby-ffi Pointer class source code, on any access to the underlying memory it has a bound check which needs to know the size to work correctly. If the pointer thinks the size is zero, you can't get the underlying data. And since this is image data, there isn't a null character to signify its end. So I need to tell the pointer how long its buffer is - and I'm not sure how to do that. Thanks, Charlie