Hello All,
https://groups.google.com/forum/#!topic/golang-nuts/swTLZyP5QK8 is a related but ancient thread. *How should Go modules be used as plugins? *My intuitive feeling is that modules <https://github.com/golang/go/wiki/Modules> are a *dramatic* feature very useful for plugins. But I don't understand how to use them concretely (what commands should be run on Linux). To be more specific, let's suppose I am *generating* the Go source code of some plugin in some fresh directory /tmp/basileplugin/ ; Assume I am able to generate all relevant sources files there, e.g. /tmp/basileplugin/go.mod /tmp/basileplugin/foo.go /tmp/basileplugin/bar.go etc... That plugin would define a single basileplugin Go package. My main program don't use statically that basileplugin. But the directory /tmp/basileplugin/ should be compiled into a /tmp/basileplugin.so plugin (and I don't know exactly how to do that, using the modules feature). My main program is using phdl, err := plugin.Open("/tmp/basileplugin.so") to load that plugin. My main program define some globmain package which exports the globmain.Globfunc function. My foo.go file (under /tmp/basileplugin) is defining a basileplugin.Foo function which calls the globmain.Globfun from my main program. My bar.go file (under /tmp/basileplugin directory also) is defining a basileplugin.Bar function which calls basileplugin.Foo function. My main program then calls phdl.Lookup("Foo") and phdl.Lookup("Bar") to get pointer to function (closures) and use them. So what are the concrete commands to build the plugin /tmp/basileplugin.so and my main program? Regards. -- Basile Starynkevitch http://starynkevitch.net/Basile/ Bourg La Reine, France <bas...@starynkevitch.net> <bas...@starynkevitch.net> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.