You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The docs at http://golang.org/cmd/cgo/ say:
---
Any C function that returns a value may be called in a multiple assignment context to
retrieve both the return value and the C errno variable as an error. For example:
n, err := C.atoi("abc")
---
This has two errors:
1. Need to wrap "abc" in C.CString
2. atoi does not set errno (at least on Linux), strtol does
I suggest to change the example to
// Will generate error since base 100 is too large
n, err := C.strtol(C.CString("10"), nil, 100)
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: