10.C_ByteSliceToVoidPtr

command
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 4 Imported by: 0

README

C.ByteSliceToVoidPtr

C.CBytes()を用いずに、[]byte(void *)に変換するには以下の手順を踏む。

  1. スライスの先頭要素のポインタを取得
  2. unsafe.Pointerを取得

cgoでは、unsafe.Pointer() がCの (void *) に当たる。

Cでは配列は「先頭要素のポインタ」を表しているが、Goではそれが出来ない。

なので、明示的に先頭要素のポインタを指定する必要がある。

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