Skip to content

Commit 7b29662

Browse files
ianlancetaylorgopherbot
authored andcommitted
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 <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Commit-Queue: Ian Lance Taylor <[email protected]>
1 parent 0751f3a commit 7b29662

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

doc/next/3-tools.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ a test integration system, you can revert to the text build output by setting
1414

1515
### Cgo {#cgo}
1616

17+
Cgo supports new annotations for C functions to improve run time
18+
performance.
19+
`#cgo noescape cFunctionName` tells the compiler that memory passed to
20+
the C function `cFunctionname` does not escape.
21+
`#cgo nocallback cFunctionName` tells the compiler that the C function
22+
`cFunctionName` does not call back to any Go functions.
23+
For more information, see [the cgo documentation](/pkg/cmd/cgo#hdr-Optimizing_calls_of_C_code).
24+
1725
Cgo currently refuses to compile calls to a C function which has multiple
1826
incompatible declarations. For instance, if `f` is declared as both `void f(int)`
1927
and `void f(double)`, cgo will report an error instead of possibly generating an

0 commit comments

Comments
 (0)