New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error passing byte array back and forth to plugin function #26436
Comments
Your program is not checking errors. Have you tried fixing that first? |
Sorry I've updated my question |
Your program is still not checking for errors correctly. All the plugin funcs return errors. |
Sorry I've updated my question again. |
For reference, the above plugin and app runs fine on Linux amd64. This issue seems to be macOS related. |
Thanks for the updates. CC @ianlancetaylor @cherrymui as per dev.golang.org/owners. |
Have you tried Go 1.11 beta? I think this should be fixed with Go 1.11 beta, probably by https://go-review.googlesource.com/c/go/+/104715. I can reproduce it with Go 1.10 but not Go tip on Mac, so I think it is fixed now. |
I tried go 1.11 beta and it's fine. Also ok on Ubuntu 18.04 |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.10.3 darwin/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/yishengyang/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/yishengyang//go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/vh/6m51srdn3ps28tc64qy1343h0000gp/T/go-build869355597=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
build the second code segment with
buildmode =plugin
and load it in the first segmentWhat did you expect to see?
no error
What did you see instead?
2018/07/18 16:47:51 From plugin GenByte
2018/07/18 16:47:51 From plugin PrintByte
2018/07/18 16:47:51 [1 2 3 4 5]
.......
After a couple of iterations
runtime: bad pointer in frame plugin/unnamed-8b1a52c90a93f94ad1c14cee47dc41ef6a9bc487.dummy.PrintByte at 0xc420055eb0: 0x5
fatal error: invalid pointer found on stack
I don't know it is go or it is me. Basically I need to pass a byte array to a plugin function. How can I achieve this?
The text was updated successfully, but these errors were encountered: