Re: [go-nuts] Appropriate Go type for cgo void* param that accepts either an offset or pointer?

2018-02-19 Thread Eric Woroshow
yhow. On Mon, Feb 19, 2018 at 5:59 PM Ian Lance Taylor wrote: > On Mon, Feb 19, 2018 at 3:09 PM, Eric Woroshow > wrote: > > > > Right, declaring the type as uintptr but requiring that the memory come > from > > C.malloc is workable, but definitely compromises ease-of-u

Re: [go-nuts] Appropriate Go type for cgo void* param that accepts either an offset or pointer?

2018-02-19 Thread Eric Woroshow
xist a good way to treat C memory as a slice. On Monday, February 19, 2018 at 12:03:00 PM UTC-8, Jan Mercl wrote: > > On Mon, Feb 19, 2018 at 8:35 PM Eric Woroshow > wrote: > > > Using uintptr might work, but my concern is that passing a Go pointer > into C by way of a uintptr

[go-nuts] Appropriate Go type for cgo void* param that accepts either an offset or pointer?

2018-02-19 Thread Eric Woroshow
There exist some OpenGL functions (e.g., glDrawElements ) where a single void* param accepts either a byte offset or a pointer value. What is the appropriate Go param type to wrap such C params? We can't use unsa