uintptr(data)false: it takes a value from data(0 type uint) and converts it to unitptrtype - with the same value converted to another type; producing a null pointer on x86.
, Go C, , , , unsafe Pointer, void* ( - ) C.
, -
import "unsafe"
var (
data [2]byte
length uint32
)
ret, _, e := procReadProcessMemory.Call(uintptr(handle), uintptr(i),
uintptr(unsafe.Pointer(&data[0])),
2, uintptr(unsafe.Pointer(&length)))
, :
- " ";
- :
unsafe.Pointer;uintptr.
, Go :
- Go, , GC "" , , , , , , .
- , , —
unsafe.Pointer GC "" , — . uintptr GC stop . , FFI/interop.
,
var data [2]byte
a := &data[0]
p := unsafe.Pointer(a)
i := uintptr(p)
data: , a p, i.
, , unitptr -typed: , " ". , , /.
, Go , . , , , . "" Go, " ": , uintptr(unsafe.Pointer) ( ) FFI/interop, , GC.
"" "" , encoding/binary no - , or -s ..; -)
2015-10-05, .
, ret ,
length.