Subject: [ruby-ffi] Re: Is the release interface supposed to swallow errors? |
From: Wayne Meissner |
Date: 10/9/13 2:04 AM |
To: ruby-ffi@googlegroups.com |
Hi,ffi 1.9.0I noticed that if I declare a struct using .auto_ptr, that the corresponding release method seems to swallow errors.require 'ffi'
class Solaris
extend FFI::Library
ffi_lib :kstat
class KstatCtl < FFI::Struct
layout(:kc_chain_id, :int, :kc_chain, :pointer, :kc_kd, :int)
def self.release(pointer)
puts "Releasing..." # Yep, I see this
bogus # Shouldn't this raise an error? Instead, nothing happens.
end
end
attach_function :kstat_open, [], KstatCtl.auto_ptr
attach_function :kstat_close, [KstatCtl], :int
def self.kstat
kptr = kstat_open()
kstat_close(kptr)
end
end
Solaris.kstatWhat I'm really trying to do is have the release method call kstat_close inside the KstatCtl's release method. It fails, but I can't tell -why- it fails since the error is getting swallowed.Help or advice appreciated.Regards,Dan