Subject: [ruby-ffi] Layout for struct with array of struct values |
From: Simon Chiang |
Date: 12/30/09 11:37 AM |
To: ruby-ffi |
How can I layout structures like this? struct field { unsigned short type; void *value; }; struct multifield { struct field theFields[1]; }; If theFields was another type, say a pointer, then I'd try something like this (although I'm not sure if this would be correct either): class Field < FFI::Struct layout :type, :ushort, :value, :pointer end class Multifield < FFI::Struct layout :theFields, [:pointer, 1] end How can I specify 'struct field' as a type?