George Hartzell writes:
>
> Quick summary, I'm trying to understand the Go structures that cgo
> gives me, how they map back onto the C structures and why a Go struct
> that doesn't quite match the cgo output seems to work anyway.
> [...]
Ian gave me a lot of good things to chew on, but didn
Ian Lance Taylor writes:
> [...]
> OK, that is true. Since your program will be using cgo, even though
> you aren't calling any C functions, it will be dynamically linked by
> default. You could try using "go build -ldflags=-extldflags=-static".
> I don't know whether it will work.
>
To c
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 sto
On Fri, Aug 30, 2019 at 4:57 PM George Hartzell wrote:
>
> Ian Lance Taylor writes:
> > On Thu, Aug 29, 2019 at 6:26 PM George Hartzell
> wrote:
> > [...]
> > There is another approach, which is to use import "C", and then write code
> like
> >
> > const IoctlConstant = C.IoctlConstant
>
Ian Lance Taylor writes:
> On Thu, Aug 29, 2019 at 6:26 PM George Hartzell wrote:
> [...]
> There is another approach, which is to use import "C", and then write code
> like
>
> const IoctlConstant = C.IoctlConstant
> type GoIoctlType = C.CIoctlType
>
> and then use those types in code
On Thu, Aug 29, 2019 at 6:26 PM George Hartzell wrote:
>
> I suppose I *could* write a cgo library that would wrap the C-based
> [i2c-tools] library, but I wanted to do it directly in Go, without
> adding the [i2c-tools] dependency.
>
> Or, are you saying that I should create a package that does t
Ian Lance Taylor writes:
> On Thu, Aug 29, 2019 at 5:15 PM George Hartzell wrote:
> >
> > Quick summary, I'm trying to understand the Go structures that cgo
> > gives me, how they map back onto the C structures and why a Go struct
> > that doesn't quite match the cgo output seems to work anyw
On Thu, Aug 29, 2019 at 5:15 PM George Hartzell wrote:
>
> Quick summary, I'm trying to understand the Go structures that cgo
> gives me, how they map back onto the C structures and why a Go struct
> that doesn't quite match the cgo output seems to work anyway.
>
> I've called out two explicit que
Quick summary, I'm trying to understand the Go structures that cgo
gives me, how they map back onto the C structures and why a Go struct
that doesn't quite match the cgo output seems to work anyway.
I've called out two explicit questions down below.
---
The Linux kernel provides a character de