tags:

views:

205

answers:

1

Is it possible to include inline assembly in Google Go code?

+7  A: 

There is no facility in the Go programming language to support in-line assembler language code, and there are no plans to do so. Go does support linking to routines written in assembler and C. There is an experimental feature which adds SWIG support to Go.

peterSO
+1 A link for a reference would make this answer perfect ;)
OscarRyz
@OscarReyes: Done
peterSO
+1 Now it is perfect ! :)
OscarRyz
It's not always necessary to use cgo to link to C code. cgo just allows calls into code compiled with GCC (for now) because Go uses an otherwise incompatible ABI. If you don't mind linking in the C code statically, you can simply write and compile it in the style of the runtime package: http://golang.org/src/pkg/runtime/. Any function starting with "·" -- a mid-dot -- is callable through Go.
Evan Shaw
@Support: How can you upvote one answer twice? :-O
Jay Sinha
@Jay, like this --> +1 ;)
OscarRyz