Forum: Ruby-core [ruby-trunk - Bug #7543][Open] DL::Function#bound? and unbound raise error when Fiddle is available

Posted by ngoto (Naohisa Goto) (Guest)
on 2012-12-11 14:22
(Received via mailing list)
Issue #7543 has been reported by ngoto (Naohisa Goto).

----------------------------------------
Bug #7543: DL::Function#bound? and unbound raise error when Fiddle is 
available
https://bugs.ruby-lang.org/issues/7543

Author: ngoto (Naohisa Goto)
Status: Open
Priority: Normal
Assignee:
Category: ext
Target version:
ruby -v: -


When Fiddle is available, DL::Function#unbind raises error.

  require 'dl'
  require 'dl/func'
  include DL
  f = Function.new(CFunc.new(0, TYPE_INT, 'test'), [TYPE_INT, TYPE_INT])
  f.bind { |x,y| x + y }
  f.unbind

The above code raises the following error in "f.unbind".
  /XXXX/lib/ruby/2.0.0/dl/func.rb:160:in `unbind': undefined method 
`ptr' for #<#<Class:0x007f8e8f29ae08>:0x007f8e8f29ad40> (NoMethodError)
          from -:6:in `<main>'

When Fiddle is available, DL::Function#bound? also raises error.

  require 'dl'
  require 'dl/func'
  include DL
  f = Function.new(CFunc.new(0, TYPE_INT, 'test'), [TYPE_INT, TYPE_INT])
  f.bind { |x,y| x + y }
  f.bound?

The above code raises the following error in "f.bound?".
  /XXXX/lib/ruby/2.0.0/dl/func.rb:174:in `bound?': undefined method 
`ptr' for #<#<Class:0x007f6708842d78>:0x007f6708842cb0> (NoMethodError)
          from -:6:in `<main>'
Posted by ngoto (Naohisa Goto) (Guest)
on 2012-12-11 14:23
(Received via mailing list)
Issue #7543 has been updated by ngoto (Naohisa Goto).

Subject changed from DL::Function#bound? and unbound raise error when 
Fiddle is available to DL::Function#bound? and unbind raise error when 
Fiddle is available


----------------------------------------
Bug #7543: DL::Function#bound? and unbind raise error when Fiddle is 
available
https://bugs.ruby-lang.org/issues/7543#change-34611

Author: ngoto (Naohisa Goto)
Status: Open
Priority: Normal
Assignee:
Category: ext
Target version:
ruby -v: -


When Fiddle is available, DL::Function#unbind raises error.

  require 'dl'
  require 'dl/func'
  include DL
  f = Function.new(CFunc.new(0, TYPE_INT, 'test'), [TYPE_INT, TYPE_INT])
  f.bind { |x,y| x + y }
  f.unbind

The above code raises the following error in "f.unbind".
  /XXXX/lib/ruby/2.0.0/dl/func.rb:160:in `unbind': undefined method 
`ptr' for #<#<Class:0x007f8e8f29ae08>:0x007f8e8f29ad40> (NoMethodError)
          from -:6:in `<main>'

When Fiddle is available, DL::Function#bound? also raises error.

  require 'dl'
  require 'dl/func'
  include DL
  f = Function.new(CFunc.new(0, TYPE_INT, 'test'), [TYPE_INT, TYPE_INT])
  f.bind { |x,y| x + y }
  f.bound?

The above code raises the following error in "f.bound?".
  /XXXX/lib/ruby/2.0.0/dl/func.rb:174:in `bound?': undefined method 
`ptr' for #<#<Class:0x007f6708842d78>:0x007f6708842cb0> (NoMethodError)
          from -:6:in `<main>'
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.