Ruby 1.9.3 リファレンスマニュアル > ライブラリ一覧 > dl/importライブラリ > DL::Functionクラス > to_i

instance method DL::Function#to_i

to_i -> Integer

自身が表す関数のアドレスを整数で返します。

require 'dl/import'

h = DL::Handle.new
addr = h.sym('strncmp')
cfunc = DL::CFunc.new(addr, DL::TYPE_INT)
func = DL::Function.new(cfunc, [DL::TYPE_VOIDP, DL::TYPE_VOIDP, DL::TYPE_INT])

p func.to_i    #=>  3084587680
class DL::Function