Subject: Re: [ruby-ffi] Inheritance and FFI::Struct |
From: Jeremy Voorhis |
Date: 8/7/10 2:10 PM |
To: ruby-ffi@googlegroups.com |
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