Subject: [ruby-ffi] Re: Having trouble with a struct |
From: Qwerty |
Date: 11/3/10 7:24 PM |
To: ruby-ffi |
Thank you for your reply. 1. Open suse 11.3 kernel: 2.6.34.7-0.5-desktop #1 SMP PREEMPT. Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz 2. I tried it with JRuby 1.5.2 and got an error about pack being undefined. I tried the alias packed with no luck. The JRuby ffi gem directory only has 1 file ffi-0.6.3-java/lib/ffi.rb. Are the other files outside this directory? The docs only show the 3 methods defined in that file(Pointer), yet is doesn't complain about FFI::Struct. 3. I would need to do some more testing but that seems to work. On Nov 3, 4:32 pm, Wayne Meissner <wmeiss...@gmail.com> wrote:
<qwerty123451...@hotmail.com> wrote:Indeed, looks like a bug. That should not be neccessary at all - that struct should pack naturally. A couple of things: 1) What OS/cpu is this on? 2) Can you try it on JRuby? 3) Can you try adding 'pack 1' before the layout line? On 4 November 2010 08:08, QwertyI found a way around the problems I was having. Any field bigger than 8 bits I declare as [:uchar,x bytes]. Feels like an ugly hack to get around what seems to be a pretty nasty bug