1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/fiddle/lib/fiddle/function.rb (Fiddle::Function#name): new

attribute needed to switch Win32::Registry from DL to Fiddle.

* ext/fiddle/lib/fiddle/import.rb (import_function, bind_function):
  set function name to the returned Fiddle::Function object.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ngoto 2012-12-06 16:21:43 +00:00
parent 5f912e7e2f
commit 0bc733d9e3
3 changed files with 17 additions and 2 deletions

View file

@ -1,3 +1,11 @@
Fri Dec 7 01:15:07 2012 Naohisa Goto <ngotogenome@gmail.com>
* ext/fiddle/lib/fiddle/function.rb (Fiddle::Function#name): new
attribute needed to switch Win32::Registry from DL to Fiddle.
* ext/fiddle/lib/fiddle/import.rb (import_function, bind_function):
set function name to the returned Fiddle::Function object.
Fri Dec 7 00:11:44 2012 Shugo Maeda <shugo@ruby-lang.org>
* test/ruby/test_refinement.rb: fix some tests to use neither

View file

@ -6,6 +6,9 @@ module Fiddle
# The address of this function
attr_reader :ptr
# The name of this function
attr_reader :name
# The integer memory location of this function
def to_i
ptr.to_i

View file

@ -290,7 +290,9 @@ module Fiddle
if( !addr )
raise(DLError, "cannot find the function: #{name}()")
end
Function.new(addr, argtype, ctype, CALL_TYPE_TO_ABI[call_type])
f = Function.new(addr, argtype, ctype, CALL_TYPE_TO_ABI[call_type])
f.instance_eval { @name = name }
f
end
# Returns a new closure wrapper for the +name+ function.
@ -307,7 +309,9 @@ module Fiddle
define_method(:call, block)
}.new(ctype, argtype, abi)
Function.new(closure, argtype, ctype, abi)
f = Function.new(closure, argtype, ctype, abi)
f.instance_eval { @name = name }
f
end
end
end