04.4.2.md

This commit is contained in:
Unknown
2013-04-23 17:27:54 -04:00
parent 48ea39b502
commit 9f0b4ae8c1
2 changed files with 3 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
#3.9 与其它语言进行交互
#3.9.1 与 C 进行交互
##3.9.1 与 C 进行交互
工具 cgo 提供了对 FFI外部函数接口的支持能够使用 Go 代码安全地调用 C 语言库,你可以访问 cgo 文档主页:[http://golang.org/cmd/cgo](http://golang.org/cmd/cgo)。cgo 会替代 Go 编译器来产生可以组合在同一个包中的 Go 和 C 代码。在实际开发中一般使用 cgo 创建单独的 C 代码包。
如果你想要在你的 Go 程序中使用 cgo则必须在单独的一行使用 `import "C"` 来导入,一般来说你可能还需要 `import "unsafe"`