Skip to content

Commit

Permalink
Comments: document cgo //export directive
Browse files Browse the repository at this point in the history
Change-Id: I2d755ce042cc710294592044f8a7b3bf857507a0
Reviewed-on: https://go-review.googlesource.com/c/wiki/+/636935
Reviewed-by: Ian Lance Taylor <[email protected]>
Commit-Queue: Ian Lance Taylor <[email protected]>
Auto-Submit: Ian Lance Taylor <[email protected]>
  • Loading branch information
ianlancetaylor authored and gopherbot committed Dec 16, 2024
1 parent 7d2f6b3 commit 069c493
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ describe the behavior of some C functions.
For full details see the [cgo
documentation](https://pkg.go.dev/cmd/cgo).

#### cgo export

In a file that uses cgo, a `//export` directive may be used to make a
Go function visible to C code.
The syntax is `//export CName` in a comment that appears before the Go
function `GoName`.
This will arrange matters such that a C call to the function `CName`
will actually call the Go function `GoName`.
For more details see the [cgo
documentation](https://pkg.go.dev/cmd/cgo#hdr-C_references_to_Go).

#### cgo compiler directives

The cgo tool generates Go code, and that generated code uses some
Expand Down

0 comments on commit 069c493

Please sign in to comment.