package main import ( "log" "plugin" "time" "dev.hexasoftware.com/stdio/plugintest/native/plugbase" ) func main() { for { callPlugin() <-time.After(2 * time.Second) // wait 2 sec } } func callPlugin() { defer func() { if r := recover(); r != nil { log.Println("Recover") } }() var err error //Reopen plugin plug, err := plugin.Open("plugins/bin/plugin1.so") panicIfErr(err) pluginfo, err := plug.Lookup("Info") panicIfErr(err) log.Println("s:", pluginfo.(*plugbase.PlugInfo).Author) fn, err := plug.Lookup("ExportedFunc") panicIfErr(err) fn.(func())() } func panicIfErr(err error) { if err != nil { panic(err) } }