【发布时间】:2019-06-03 16:33:40
【问题描述】:
我将使用 cgo 将一个 c 库包装为 go 库以供项目使用。我阅读了文档,使用 cgo 时似乎有很多规则。我不知道这是否合法。
LibCtx 和 Client 都是 C 中的结构。这是将 C 结构放入 golang 结构的合法方式吗?
//DBClientLib.go
type DBClient struct {
Libctx C.LibCtx
LibClient C.Client
}
func (client DBClient) GetEntry(key string) interface{} {
//...
}
【问题讨论】: