使用 Go 为 iPhone 应用程序编写库
我正在考虑使用 Go 作为 C/Objective-C 的低级高性能语言替代品来实现 iPhone 应用程序的库。 Go 编译器中的任何一个都可以生成一个可以使用 Go 运行时等链接到本机 iPhone 应用程序的库吗? Go 是否有 ARM 端口,或者 gccgo/gcc 支持吗?我想,由于 gccgo 使用 gcc 作为后端,并且 Xcode 使用 gcc 来编译 iPhone 应用程序,因此很有可能这是可能的。如果可能的话,我该如何在 Xcode 项目中进行设置?
有没有人尝试过这个或之前看过它的讨论? (当我在 Google 上搜索“编译 go 代码 iphone”时,“go”部分完全没有使用,我只得到有关 iPhone 开发的内容。)
I'm considering using Go as a low-level, performant language alternative to C/Objective-C to implement a library for an iPhone App. Could either of the Go compilers generate a library that could be linked into a native iPhone app with the Go runtime, etc.? Is there an ARM port for Go or does gccgo/gcc support this? I imagine that since gccgo uses gcc as the back-end and Xcode uses gcc to compile iPhone apps that there is a strong chance that this is possible. If it's possible, how would I set that up in an Xcode project?
Has anyone tried this or seen it discussed before? (When I do a Google search like "compiling go code iphone" the "go" part is completely unused and I get only stuff about iPhone development.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Go 目前不支持 iphone 平台,但它支持 ARM 处理器。不过,邮件列表上对此没有太多讨论。
Go doesn't support the iphone platform right now, but it does support ARM processors. There hasn't been much discussion about this on the mailing list though.
即使可能,我怀疑 Go 比 C 或 Objective C 慢得多。大多数独立基准测试似乎表明使用当前开发版本的性能很差。这些针对 C 的微基准建议 Go 比 C 慢 2 到 150 倍,甚至比 Java 和 C# Mono 还慢。所以我认为没有理由称 Go 为高性能替代方案。
尽管这取决于您的应用程序,但我怀疑利用 GPU api 是解决大多数性能问题的最佳选择。
Even if possible, I suspect Go is significantly slower than C or Objective C. Most independent benchmarks seem to suggest poor performance using the current development versions. These microbenchmarks against C suggest Go is 2 to 150 times slower than C. It is even slower than Java and C# Mono. So I see little reason to call Go a performant alternative.
Although it depends on your application, I suspect leveraging the GPU api is the best bet for most performance problems.
至少要看看 Lua。它速度很快,是我喜欢使用的语言。 iPhone Wax 使用卢阿。
One thing to at least look at would be Lua. It is fast and is a language I like using. iPhone Wax uses lua.
Go Mobile 项目现在对 IOS 和 Android 移动开发提供了一些支持。请参阅关于针对 IOS 构建的 wiki 部分了解您的申请的详细信息。
The Go Mobile project now has some support for IOS and Android mobile development. See the wiki section on Building for IOS for details for your application.