Shared library in Go?

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!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)