Subject:
Re: [ruby-ffi] Pointer to a struct - how to cast?
From:
DA
Date:
5/21/10 8:10 AM
To:
ruby-ffi@googlegroups.com

On Thu, May 20, 2010 at 9:13 PM, Wayne Meissner <wmeissner@gmail.com> wrote:
> Try using FFI::Pointer#+
>
> e.g.
> 0.upto(tis[:len]).each do |i|
>  s = FM::FTexFtItemT.new(tis[:val] + (i * FM::FTexFtItemT.size))
>  # do stuff with s here
> end

Hi Wayne, thanks a bunch, this works perfectly (minus the .each).

Would this be a good example to add to the wiki, perhaps under
"Structs > Array of Structs"?  I would be happy to add it.  (It also
would illustrate using a union in a struct).

Drew