19.C_NULL

command
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2024 License: MIT Imports: 3 Imported by: 0

README

これは何?

cgoを利用している場合で、C側の関数に NULL を渡すやり方についてのサンプルです。

NULL を渡すには、Goの nil を使って以下のようにします。

unsafe.Pointer(nil)

あとは、これを関数の引数の型に合わせてキャストして渡します。

サンプルを実行すると以下のようになります。

$ task
task: [default] go run .
NULL     ==> -1
NOT NULL ==> 0

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL