DEV Community

Discussion on: Golang and shared objects Part 1 - The background

 
ik5 profile image
ik_5

As I wrote using the first part, it is a mean to share code that external to the system.

Go uses most of the time static libraries that are compiles inside.
So you are fixated with what you have built the binary with.

If you have a bug in a library, you still need to rebuild the binary.

Using shared object you can just deploy that (something that MS does most of the times).

Also it is a way to create plugins. Let's say you have an RPC interface, and you want to be open for many ways to communicate, sometimes GRPC, sometimes REST, pure TCP or whatever.

You can gain that using a shared object, and load it on runtime (it acts a bit different then on compile time) based on a configuration or need.

For example I have a system that communicates with 4 types of different vendors that each communicate in different protocols. But my system does not require to support all of them at the same time, so only the ones I do need to support are loaded using configuration and a library.

Thread Thread
 
evilcel3ri profile image
chris

Oh! That is really interesting. I never thought about doing it that way. Thank you!