mirror of https://github.com/golang/go.git
doc/next: add notes for new #cgo annotations
Fixes #56378 Change-Id: Ibeaa5aa67e017be0da8797e4c87abf2ee0249db8 Reviewed-on: https://go-review.googlesource.com/c/go/+/632015 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Commit-Queue: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
0751f3af92
commit
7b296625e4
|
|
@ -14,6 +14,14 @@ a test integration system, you can revert to the text build output by setting
|
|||
|
||||
### Cgo {#cgo}
|
||||
|
||||
Cgo supports new annotations for C functions to improve run time
|
||||
performance.
|
||||
`#cgo noescape cFunctionName` tells the compiler that memory passed to
|
||||
the C function `cFunctionname` does not escape.
|
||||
`#cgo nocallback cFunctionName` tells the compiler that the C function
|
||||
`cFunctionName` does not call back to any Go functions.
|
||||
For more information, see [the cgo documentation](/pkg/cmd/cgo#hdr-Optimizing_calls_of_C_code).
|
||||
|
||||
Cgo currently refuses to compile calls to a C function which has multiple
|
||||
incompatible declarations. For instance, if `f` is declared as both `void f(int)`
|
||||
and `void f(double)`, cgo will report an error instead of possibly generating an
|
||||
|
|
|
|||
Loading…
Reference in New Issue