Question
Shared library in Go?
Is it possible to create a Shared Library (.so) using Go?
UPDATED: created an "issue" for it.
Question
Is it possible to create a Shared Library (.so) using Go?
UPDATED: created an "issue" for it.
Solution
This is possible now using -linkshared
flag
What you need to do is to first run this command:
go install -buildmode=shared -linkshared std
(Above code makes all common packages shareable!) then
go install -buildmode=shared -linkshared userownpackage
finally when compiling your code you need to run:
go build -linkshared yourprogram
What the above those is now it rather than statically linking everything only dynamically links them and you will end up with much smaller compiled files. Just to give you an idea my "hello.go" file with static linking is 2.3MB while the same code using dynamic linking is just 12KB!
Solution
Possible now! I built a .so file using Go and then imported into python quite easily! Here is an articles that I liked: http://www.darkcoding.net/software/building-shared-libraries-in-go-part-1/