Slide 11
Slide 11 text
2/25/2017 Go 1.8 Plugins
http://localhost:3999/go-1.8-plugins.slide#1 11/20
Load a Plugin
Load the plugin by passing the path to the .so to plugin.Open()
func main() {
p, err := plugin.Open("adder-plugin/adder-plugin.so")
if err != nil {
panic(err)
}
v, err := p.Lookup("V")
if err != nil {
panic(err)
}
f, err := p.Lookup("F")
if err != nil {
panic(err)
}
*v.(*int) = 7
f.(func())() // prints "Hello, number 7"
}