Skip to content
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

cgo error #46

Open
fantajeon opened this issue Mar 5, 2016 · 0 comments
Open

cgo error #46

fantajeon opened this issue Mar 5, 2016 · 0 comments

Comments

@fantajeon
Copy link

When I pass [] bytes variable to curl.Setopt with CURL_POSTFIELDS, I got error "cgo argument has go pointer to go pointer" at 268 line in easy.go:
panic(0x85ee60, 0xc8202200c0)
/usr/local/go/src/runtime/panic.go:464 +0x3e6
github.com/andelf/go-curl._cgoCheckPointer0(0x79f980, 0xc8202200a0, 0xc8202200b0, 0x1, 0x1, 0x7fc858001cc0)
??:0 +0x4d
github.com/andelf/go-curl.(*CURL).Setopt(0xc8201eb2c0, 0x271f, 0x78fb20, 0xc82020cca0, 0x0, 0x0)
/home/ubuntu/go/src/github.com/andelf/go-curl/easy.go:268 +0x2271

I changed the source file and tested as followings:
case []byte:
b := param.([]byte)
ptr := unsafe.Pointer(&b[0])
return newCurlError(C.curl_easy_setopt_string(p, C.CURLoption(opt), (*C.char)(ptr)))

How about my changed code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant