[go-nuts] Re: casting arbitrary int to unsafe.Pointer: go test -race (checkptr) complains

2020-07-10 Thread 'Hraban Luyat' via golang-nuts
This is a great idea for a work-around. Fixed, thanks! On Friday, 10 July 2020 at 00:34:58 UTC+1 keith@gmail.com wrote: > Just write a wrapper on the C side (in the import "C" code) that takes a > uintptr and casts it to void*. > > func wrapper(a uintptr, b, c, d, e ...) { > op_open_callbac

[go-nuts] Re: casting arbitrary int to unsafe.Pointer: go test -race (checkptr) complains

2020-07-09 Thread 'Hraban Luyat' via golang-nuts
Because the C function I'm calling takes a "void *" param. Can you pass a regular Go int as a "void *" argument somehow without going through unsafe.Pointer? Note I don't directly call go_readcallback; I call op_open_callbacks (not under my control) and pass it the go_readcallback as a callback