Ruby 2.1.0 リファレンスマニュアル > ライブラリ一覧 > dl/importライブラリ > DL::Functionクラス > new
new(cfunc, argtypes) -> DL::Function[permalink][rdoc]new(cfunc, argtypes) {|*arg| ... } -> DL::Function指定された DL::CFunc オブジェクト cfunc をラップする DL::Function オブジェクトを生成して返します。
- TYPE_CHAR
を使います。
例:
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.call("abcd", "abcz", 3) #=> 0
[SEE_ALSO] DL::TYPE_INT