Ruby 2.0.0 リファレンスマニュアル > ライブラリ一覧 > dl/importライブラリ > DL::Functionクラス > to_i
to_i -> Integer[permalink][rdoc]自身が表す関数のアドレスを整数で返します。
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