4 ms·
I like go, I'd love to write libraries in it but as far as I can tell you can't really create a C compatible shared library from it. That it still the common d
by ericfrederich 10y ago
I like go, I'd love to write libraries in it but as far as I can tell you can't really create a C compatible shared library from it.
That it still the common denominator if you want to call into it from other languages.
I'd love to write Python programs with performance critical stuff in Go
- LukeShu 10y agoas far as I can tell you can't really create a C compatible shared library from [Go]. Sure you can! (as of Go 1.5, iirc) Change your build command to use the c-shared build mode: go build -buildmode=c-shared Then, to change the linkage of the functions you want to export, use the magical comment "//export" directive: //export MyFunction func MyFunction(arg1, arg2 int, arg3 string) int64 { ...
- steveklabnik 10y agoThis still doesn't get over the inherent overhead in calling between the two languages though, right? (And you're bringing that whole runtime with you. Which might be okay! As always, it depends.)
- deleted 10y ago[deleted]