Project

General

Profile

Actions

Bug #7543

closed

DL::Function#bound? and unbind raise error when Fiddle is available

Added by ngoto (Naohisa Goto) over 11 years ago. Updated over 11 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
-
Backport:
[ruby-core:<unknown>]

Description

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 `'

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 `'

Actions

Also available in: Atom PDF

Like0
Like0Like0