Closed nguoinaodo closed 5 years ago
Go pointer can not be passed to C function as C pointer. Please look at setupStrm in zdeltago. This is changed in go1.6 specification. Note that it's not possible to pass Go pointer into C world even if it is defined as void*
in C function.
For workaround, this possibly help you. https://github.com/mattn/go-pointer
As far as I can tell, this is working as documented and intended. See https://golang.org/cmd/cgo/#hdr-Passing_pointers . Please comment if you disagree.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.8 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/ubuntu/dev/go" GORACE="" GOROOT="/usr/local/go" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build585877189=/tmp/go-build -gno-record-gcc-switches" CXX="g++" CGO_ENABLED="1" PKG_CONFIG="pkg-config" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2"
What did you do?
What did you expect to see?
Program to run normally and show length of delta.
What did you see instead?
Error output:
This is the code block that cause the error:
This is the C.zd_streamp declaration I think it may help: