diff options
Diffstat (limited to 'plugin.go')
| -rw-r--r-- | plugin.go | 32 |
1 files changed, 15 insertions, 17 deletions
@@ -8,6 +8,7 @@ package gui import ( "embed" "errors" + "fmt" "os" "path/filepath" "plugin" @@ -233,29 +234,26 @@ func searchPaths(name string) *aplug { return nil } -// tests the plugin file will load -func testPlugin() { - _, err := plugin.Open(argGui.GuiTest) - if err != nil { - log.Log(PLUG, "plugin.Open() FAILED =", argGui.GuiTest, err) - os.Exit(-1) - } - log.Log(PLUG, "plugin.Open() SUCCESS loading plugin =", argGui.GuiTest) - os.Exit(0) -} - // load module // 1. open the shared object file to load the symbols func initToolkit(name string, filename string) *aplug { - if _, err := os.Stat(filename); err != nil { - if os.IsNotExist(err) { - log.Log(PLUG, "initToolkit() missing plugin", name, "as filename", filename) - return nil + /* + if _, err := os.Stat(filename); err != nil { + if os.IsNotExist(err) { + log.Log(PLUG, "initToolkit() missing plugin", name, "as filename", filename) + return nil + } } + log.Log(PLUG, "initToolkit() Found plugin", name, "as filename", filename) + + plug, err := plugin.Open(filename) + */ + if err := CheckPluginViaSubprocess(filename); err != nil { + fmt.Printf("initToolkit() subprocess load plugin failed: %v\n", err) + return nil } - log.Log(PLUG, "initToolkit() Found plugin", name, "as filename", filename) - plug, err := plugin.Open(filename) + plug, err := checkPlug(filename) if err != nil { // turn on PLUG debugging if something goes wrong PLUG.SetBool(true) |
