Subject:
[ruby-ffi] Inheritance and FFI::Struct
From:
Matijs van Zuijlen
Date:
8/7/10 8:10 AM
To:
ruby-ffi

Hello all,

I'm trying to set up an inheritance chain that ultimately inherits from FFI::Struct. However, the derived classes have a different layouts. This results in warnings about class variables being overridden.

The following code demonstrates the problem when run with ruby -w:

  require 'ffi'

  class Foo < FFI::Struct
    layout :a, :int, :b, :int
  end

  class Bar < Foo
    layout :p, Foo, :c, :int
  end

  bar = Bar.new

I could set up separate Foo::Struct and Bar::Struct classes to avoid this problem, but I'd rather not, as it introduces a lot of extra complexity.

Any thoughts?

Regards,
-- 
Matijs