I understand it is possible to use existing shared libraries written in C/C++ etc in Go, but is it possible to write the shared libraries in Go and then use/include them dynamically in code?
The use case is for an application that require plugins and the application will use whatever plugins is specified.
@bins, thanks for the answer. So it is possible to link existing libraries written in other languages, but is it possible to write the library in Go, and then use that library dynamically in Go?
note that dlopen-ing a Go shared library from Go and using its symbols isn’t (AFAIK) working readily yet.
you’d have to use the Cdlopen library and unsafe-cast to a Go value.
that’s what the plugin package is meant to do.
it’s not yet written. (but I am slowly working on it there: https://github.com/sbinet/go-plugin)