增加 Example.

Signed-off-by: rick.chan <chenyang@autoai.com>
This commit is contained in:
rick.chan 2021-01-06 13:35:42 +08:00
parent fe4f04ba13
commit e31607662b
1 changed files with 3 additions and 1 deletions

View File

@ -2,7 +2,7 @@
CGO is an official builtin feature of Go, it enables the creation of Go packages that reference to C libraries. But it isnt just that, it is achievable in the opposite direction, too. It enables creation of C libraries from Go packages so that C code can reference to Go, which is mind-blowing.
CGO 不但可以使 Go 包访问 C 库,还可以通过 Go 包创建 C 库。
CGO 不但可以使 Go 包访问 C 库,还可以通过 Go 包创建 C 库,进而使 C/C++ 程序可调用 Go 语言程序
## 1.How to
@ -40,6 +40,8 @@ To export a Go function as a C symbol:
* 在要导出的函数使用 **//export FuncName** 注释;
* 不能使用 Go struct、Go interface、Go arra、以及可变参数。
## 2.Example
```go
package main