4 ms·
as 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
by LukeShu 10y ago
as 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]