Subject: [ruby-ffi] 2D arrays |
From: galdor |
Date: 12/10/09 5:51 PM |
To: ruby-ffi |
Hi, I'm trying to bind the following structure: struct ALLEGRO_TRANSFORM { float m[4][4]; }; But with the following FFI declaration: class ALLEGRO_TRANSFORM < FFI::Struct layout :m, [[:float, 4], 4] end I get the following error: /usr/lib/ruby/gems/1.9.1/gems/ffi-0.6.0pre/lib/ffi/struct.rb:177:in `add_array': undefined method `alignment' for [:float, 4]:Array (NoMethodError) from /usr/lib/ruby/gems/1.9.1/gems/ffi-0.6.0pre/lib/ffi/ struct.rb:177:in `array_layout' from /usr/lib/ruby/gems/1.9.1/gems/ffi-0.6.0pre/lib/ffi/ struct.rb:106:in `layout' from lib/allegro/ffi_allegro.rb:558:in `<class:ALLEGRO_TRANSFORM>' from lib/allegro/ffi_allegro.rb:557:in `<module:Allegro>' from lib/allegro/ffi_allegro.rb:4:in `<main>' Is there a specific syntax for 2D arrays ? Regards, Nicolas Martyanoff