るりまサーチ

最速Rubyリファレンスマニュアル検索!
36件ヒット [1-36件を表示] (0.041秒)
トップページ > クエリ:-[x] > クエリ:typealias[x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method gets
  4. irb/input-method new
  5. matrix -

ライブラリ

モジュール

キーワード

検索結果

Fiddle::Importer#typealias(new, orig) -> () (18201.0)

extern や struct で利用する型の別名を定義します。

extern や struct で利用する型の別名を定義します。

@param new 別名(文字列)
@param orig 別名を付けたい型の名前(文字列)
@see Fiddle::Importer#extern, Fiddle::Importer#sizeof,
Fiddle::Importer#struct, Fiddle::Importer#union

Fiddle::Importer#bind(signature, *opts) { ... } -> Fiddle::Function (124.0)

Ruby のブロックを C の関数で wrap し、その関数をモジュールに インポートします。

...とシネグチャ
@param opts オプション


require 'fiddle/import'

module M
extend Fiddle::Importer
dlload "libc.so.6"
typealias
"size_t", "unsigned long"
extern "int qsort(void*, size_t, size_t, void*)"

bind("int compare(void*, void*)"){|px, py|
x = px...
....to_s(Fiddle::SIZEOF_INT).unpack("i!")
y = py.to_s(Fiddle::SIZEOF_INT).unpack("i!")

x <=> y
}
end

data = [32, 180001, -13, -1, 0, 49].pack("i!*")
M.qsort(Fiddle::Pointer[data], 6, Fiddle::SIZEOF_INT, M["compare"])
p data.unpack("i!*") # => [-13, -1, 0, 32, 49, 180001]...

Fiddle::Importer#union(signature) -> Class (112.0)

C の共用体型に対応する Ruby のクラスを構築して返します。

...oll_data_t;
は、Ruby上では
require 'fiddle/import'

module M
extend Fiddle::Importer
dlload "libc.so.6"
typealias
("uint32_t", "unsigned int")
typealias
("uint64_t", "unsigned long long")

EPollData = union(["void *ptr",
"int fd",...