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.
yes, starting with go-1.5, it’s possible. see:
@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?
support varies among architectures and platforms. I believe go-1.6 has support for
I haven’t worked out a recipe, though.
the tests are there:
Go shared library from
Go and using its symbols isn’t (AFAIK) working readily yet.
you’d have to use the
dlopen library and
unsafe-cast to a
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)
Thanks @bins, much appreciated
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.