George Hartzell writes:
> [...]
> ```
> i2c/i2c.go:15:9: cannot use &buf[0] (type *byte) as type *_Ctype_uchar
> in assignment
> ```
>
> I can't come up with any cast that makes the compiler happy. I'm also
> unsure whether that line runs afoul of this commandment: *Go code may
> not store a Go pointer in C memory* from https://golang.org/cmd/cgo/.
>
Hmmm. Well this works, and building/running with GODEBUG=cgocheck=2
doesn't complain, so perhaps it's ok?
```
[...]
buf := [2]C.__u8{}
im.addr = 0x18
im.flags = C.I2C_M_RD
im.len = C.__u16(len(buf))
im.buf = &buf[0]
[...]
```
g.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/23913.48871.513272.764573%40alice.local.