Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Go to write a library for an iPhone app

Tags:

c

gcc

iphone

go

arm

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.)

like image 982
Jared Updike Avatar asked Feb 13 '10 22:02

Jared Updike


People also ask

Does Golang work on iOS?

Apps written entirely in Go have a main function, and can be built with `gomobile build`, which directly produces runnable output for Android and iOS. The gomobile tool can get installed with go get. For reference, see https://golang.org/x/mobile/cmd/gomobile.

How do I organize my apps library?

On an iPhone or Android device, gently place your finger on an icon and drag it on top of another app. The phone will automatically create a folder containing those two apps. Tap Done. To add apps into an existing folder, drag an app into that folder.

What is iPhone app Library?

App Library shows your apps organized into categories, such as Creativity, Social, and Entertainment. The apps you use most are near the top of the screen and at the top level of their categories, so you can easily locate and open them.


2 Answers

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.

like image 185
marketer Avatar answered Oct 04 '22 02:10

marketer


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.

like image 25
Tristan Avatar answered Oct 04 '22 02:10

Tristan