Subject:
Re: [ruby-ffi] Using enums in InlineArray
From:
Wayne Meissner
Date:
12/8/10 5:30 PM
To:
ruby-ffi@googlegroups.com

This should be fixed on master now (and also JRuby master).  Give it a
try and let me know if it works.


On 7 December 2010 02:52, edek <edek123456@gmail.com> wrote:
> Hi,
>
> in my project I've got complex structure, that contains an array of
> enums.
>
> So I define named enum type and pass it to my struct layout.
>
> This structure is referenced in another structure.
>
> When I read my structure, FFI automatically creates object of type
> FFI::Struct::InlineArray.
>
> Unfortunately, when I try to read its contents I got following error:
> `each': get not supported for FFI::Enum (ArgumentError)
>
> It works well when I switch type to :uint32 - I can read integers.
>
> Is there any way to use enums in this place? That would be obviously
> much more ellegant. If it is not supported yet, could you give me any
> advice where I can extend FFI's functionality in this matter?
>
> Thank you,
>
> Marcin