Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with find_type and child classes in Ruby 2.0.0 #256

Closed
meh opened this issue Mar 24, 2013 · 1 comment
Closed

Issue with find_type and child classes in Ruby 2.0.0 #256

meh opened this issue Mar 24, 2013 · 1 comment

Comments

@meh
Copy link
Contributor

meh commented Mar 24, 2013

#! /usr/bin/env ruby
require 'ffi'

module Test
    extend FFI::Library

    ffi_lib FFI::Library::LIBC

    callback :bug, [], :void

    class Foo < FFI::Struct
        class Bar < FFI::Struct
            layout :a, :bug
        end

        layout :b, Bar
    end
end
/home/meh/.gem/ruby/2.0.0/gems/ffi-1.5.0/lib/ffi/types.rb:57:in `find_type': unable to resolve type 'bug' (TypeError)
        from /home/meh/.gem/ruby/2.0.0/gems/ffi-1.5.0/lib/ffi/struct.rb:316:in `find_type'
        from /home/meh/.gem/ruby/2.0.0/gems/ffi-1.5.0/lib/ffi/struct.rb:309:in `find_field_type'
        from /home/meh/.gem/ruby/2.0.0/gems/ffi-1.5.0/lib/ffi/struct.rb:351:in `array_layout'
        from /home/meh/.gem/ruby/2.0.0/gems/ffi-1.5.0/lib/ffi/struct.rb:261:in `layout'
        from lol.rb:13:in `<class:Bar>'
        from lol.rb:12:in `<class:Foo>'
        from lol.rb:11:in `<module:Test>'
        from lol.rb:4:in `<main>'

This used to work on 1.9.

@ghost
Copy link

ghost commented Mar 24, 2013

Looks like this is due to this behavioural change in 2.0 http://tenderlovemaking.com/2012/09/07/protected-methods-and-ruby-2-0.html

Looks like it should be pretty easy to fix.

ghost pushed a commit that referenced this issue Mar 24, 2013
… enclosing module is a FFI::Library or a FFI::Struct
@ghost ghost closed this as completed in jruby/jruby@5b408dd Mar 26, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant