648件ヒット
[601-648件を表示]
(0.006秒)
クラス
-
Fiddle
:: CStruct (24) -
Fiddle
:: Closure (36) -
Fiddle
:: Closure :: BlockCaller (12) -
Fiddle
:: Function (60) -
Fiddle
:: Handle (84) -
Fiddle
:: Pointer (300)
モジュール
-
Fiddle
:: Importer (132)
キーワード
- + (12)
- +@ (12)
- - (12)
- -@ (12)
- <=> (12)
- == (12)
- [] (48)
- []= (24)
- abi (12)
- args (12)
- bind (12)
- call (24)
- close (12)
-
close
_ enabled? (12) -
create
_ value (12) - ctype (12)
-
disable
_ close (12) - dlload (12)
-
enable
_ close (12) - eql? (12)
- extern (12)
- free (12)
- free= (12)
-
import
_ symbol (12) - name (12)
- null? (12)
- ptr (24)
- ref (12)
- size (12)
- size= (12)
- sizeof (12)
- struct (12)
- sym (12)
-
to
_ i (60) -
to
_ int (12) -
to
_ ptr (12) -
to
_ s (24) -
to
_ str (24) -
to
_ value (12) - typealias (12)
- union (12)
- value (12)
検索結果
先頭4件
-
Fiddle
:: Importer # struct(signature) -> Class (2.0) -
C の構造体型に対応する Ruby のクラスを構築して返します。
...セサ
返されるクラスは Fiddle::CStruct を継承しています。詳しくは
そちらを参照してください。
@param signature 構造体の各要素を文字列で表現したものの配列
require 'fiddle/import'
module M
extend Fiddle::Importer
dlload "libc.so.......6"
extern "int gettimeofday(void*, void*)"
Timeval = struct(["long tv_sec", "long tv_usec"])
end
time = M::Timeval.malloc
M.gettimeofday(time, Fiddle::NULL)
p time.tv_sec
p time.tv_usec... -
Fiddle
:: Importer # typealias(new , orig) -> () (2.0) -
extern や struct で利用する型の別名を定義します。
...extern や struct で利用する型の別名を定義します。
@param new 別名(文字列)
@param orig 別名を付けたい型の名前(文字列)
@see Fiddle::Importer#extern, Fiddle::Importer#sizeof,
Fiddle::Importer#struct, Fiddle::Importer#union... -
Fiddle
:: Importer # union(signature) -> Class (2.0) -
C の共用体型に対応する Ruby のクラスを構築して返します。
...定義する方法は Fiddle::Importer#struct と
ほぼ同様です。C における
typedef union epoll_data
{
void *ptr;
int fd;
uint32_t u32;
uint64_t u64;
} epoll_data_t;
は、Ruby上では
require 'fiddle/import'
module M
extend Fiddle::Importer
dlload "li......"uint32_t u32",
"uint64_t u64",
])
end
となります。
返されるクラスは Fiddle::CUnion を継承しています。
1.9.x ではこのメソッドで返されるクラスは正しく動作しません。
2.0以降では修... -
Fiddle
:: Importer # value(type , val = nil) -> Fiddle :: CStruct (2.0) -
型が type で要素名が "value" であるような構造体を 定義(Fiddle::Importer#struct)し、 その構造体のメモリを Fiddle::CStruct#malloc で確保し、 確保したメモリを保持しているオブジェクトを返します。
...型が type で要素名が "value" であるような構造体を
定義(Fiddle::Importer#struct)し、
その構造体のメモリを Fiddle::CStruct#malloc で確保し、
確保したメモリを保持しているオブジェクトを返します。
type は "int", "void*" といった文字列......された構造体に
その値を代入します。
@param type 型を表す文字列
@param val 構造体に確保される初期値
例
require 'fiddle/import'
module M
extend Fiddle::Importer
end
v = M.value("int", 32)
p v.value # => 32
v.value = 48
p v.value # => 48...