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

Uninitialized constant in Fiddle::Pointer.malloc #3462

Closed
gdelugre opened this Issue Nov 15, 2015 · 3 comments

Comments

Projects
None yet
4 participants
@gdelugre

gdelugre commented Nov 15, 2015

When allocating memory with Fiddle on JRuby 9.0.3.0, a NameError exception is raised because the LibC module is not defined.

jruby-9.0.3.0 :001 > require 'fiddle'
 => true 
jruby-9.0.3.0 :002 > Fiddle::Pointer.malloc 16
NameError: uninitialized constant Fiddle::Pointer::LibC
    from org/jruby/RubyModule.java:3181:in `const_missing'
    from /home/user/.rvm/rubies/jruby-9.0.3.0/lib/ruby/stdlib/fiddle/jruby.rb:168:in `malloc'
    from (irb):2:in `<eval>'
    from org/jruby/RubyKernel.java:978:in `eval'
    from org/jruby/RubyKernel.java:1291:in `loop'
    from org/jruby/RubyKernel.java:1098:in `catch'
    from org/jruby/RubyKernel.java:1098:in `catch'
    from /home/user/.rvm/rubies/jruby-9.0.3.0/bin/irb:13:in `<top>'

The related code in stdlib/fiddle/jruby.rb:

    def self.malloc(size, free = nil)
      self.new(LibC.malloc(size), size, free ? free : LibC::FREE)
    end
@chrisseaton

This comment has been minimized.

Contributor

chrisseaton commented Dec 25, 2016

There are other parts of Fiddle missing, for example Fiddle::Handle::DEFAULT and Fiddle::CParser::TYPE_SIZE_T (which importer tries to use for size_t).

@enebo

This comment has been minimized.

Member

enebo commented Mar 6, 2017

Original PR was reverted to reopening

@enebo enebo reopened this Mar 6, 2017

@headius headius closed this in 482159b May 16, 2018

@headius

This comment has been minimized.

Member

headius commented May 16, 2018

I fixed this one issue for 9.2 Any additional issues should be file separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment