File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -209,6 +209,17 @@ function returns void). For example:
209
209
_, err := C.voidFunc()
210
210
var n, err = C.sqrt(1)
211
211
212
+ Note that the C errno value may be non-zero, and thus the err result may be
213
+ non-nil, even if the function call is successful. Unlike normal Go conventions,
214
+ you should first check whether the call succeeded before checking the error
215
+ result. For example:
216
+
217
+ n, err := C.setenv(key, value, 1)
218
+ if n != 0 {
219
+ // we know the call failed, so it is now valid to use err
220
+ return err
221
+ }
222
+
212
223
Calling C function pointers is currently not supported, however you can
213
224
declare Go variables which hold C function pointers and pass them
214
225
back and forth between Go and C. C code may call function pointers
You can’t perform that action at this time.
0 commit comments