3 ms·
How is go not portable to all of those platforms?
by rhodysurf 11y ago
How is go not portable to all of those platforms?
- tosseraccount 11y agoNo doubt it's potentially portable. Can I compile a GO only program and run on ios?
- fit2rule 11y agoI did it, its trivial. The magic sauce is all in the use of the #cgo directive, which gives you a way of exporting Go to iOS code and vice versa. I ported IPFS (http://ipfs.io/ http://ipfs.io/) as a test, and it runs quite well on iOS: https://github.com/seclorum/ios-go-ipfs/blob/master/ipfsios/ipfsios/gosources/main.go https://github.com/seclorum/ios-go-ipfs/blob/master/ipfsios/...
- rhodysurf 11y agoYou dont need to do any of the cgo stuff manually anymore with gomobile
- tosseraccount 11y agoIs see stuff like 'cgo' and 'import "C"'. What's going on here?
- fit2rule 11y agoThis is the glue that the Go compiler needs to export its symbols in a way that they can be used from the C side of things in Objective-C, and vice versa. Think of it like a toll-free bridge [ * ] between the ObjC and Golang runtimes. [ * - See https://en.wikipedia.org/wiki/Bridging_(programming) https://en.wikipedia.org/wiki/Bridging_(programming) ]