0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Ruby-FFIでポインタのポインタを作る

Posted at

勘違いしていたので反省を込めて短い記事。

Ruby-FFIで関数に渡すポインタのポインタを作るときは、

ptr_ptr = FFI::MemoryPointer.new(:pointer)

の1行だけでOK。このとき、ptr_ptr は「ヌルポインタ」へのポインターである。

ptr = FFI::MemoryPointer.new(:pointer)
ptr_ptr = FFI::MemoryPointer.new(ptr)

とすると、ヌルポインタのポインタのポインタになってしまうので間違い。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?