Go中的条件编译 [英] Conditional compilation in Go
问题描述
我正尝试使用包装 ://golang.org/cmd/cgo/rel =noreferrer> CGo for ENet < a>。 当我试图在Mac上编译我的包装时,库更旧,并且接口略有不同。 99%的代码是相同的,只有几个C调用需要更改。 在Go中处理这样的问题的最佳做法是什么? Go没有条件编译或条件导入。处理C代码中的类型差异。 I'm trying to write a Go wrapper using CGo for ENet. When I tried to compile my wrapper on a Mac the library was older and had a slightly different interface. 99% of the code is the same just a few C calls need to change. What is the best practice for dealing with a problem like this in Go? Go does not have conditional compilation or conditional imports. Handle the type differences in C code. Are the [Go] authors opposed to preprocessing? 这篇关于Go中的条件编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
是否有一些方法可以执行条件编译或条件导入?
Is there some way to do conditional compilation or conditional imports?