26

如何使用 Go 的“外部函数接口”调用 C 函数?

FAQ中提到了这个接口,但我在文档的其他地方看不到它。

4

2 回答 2

18

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.

于 2010-04-29T20:02:38.250 回答
2

这是一篇使用Cgo演示以下内容的文章:

举个例子,这是一个 Go 包,它提供了两个函数 -Random并且Seed- 包装了 Crandsrand函数。

于 2013-07-30T02:01:20.727 回答