如何使用 Go 的“外部函数接口”来调用 C 函数?
FAQ 中提到了此接口,但我在文档的其他地方看不到它。
How do I use Go's "foreign function interface" to call out to a C function?
This interface is mentioned on the FAQ, but I cannot see it mentioned elsewhere in the docs.
从 Go 存储库查看此文件 。它展示了如何在 Go 中包装 C 库,并有相当多的注释解释了该过程。
Check out this file from the Go repository. It shows how to wrap a C library in Go and has quite a few comments that explain the process.
这是一篇 文章,它使用 Cgo:
举个例子,这里有一个 Go 包,它提供了两个 函数 - Random 和 Seed - 包装 C 的 rand 和 srand 函数。
Random
Seed
rand
srand
Here is an article that demonstrates the following with Cgo:
To lead with an example, here's a Go package that provides two functions - Random and Seed - that wrap C's rand and srand functions.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(2)
从 Go 存储库查看此文件 。它展示了如何在 Go 中包装 C 库,并有相当多的注释解释了该过程。
Check out this file from the Go repository. It shows how to wrap a C library in Go and has quite a few comments that explain the process.
这是一篇 文章,它使用 Cgo:
Here is an article that demonstrates the following with Cgo: