summaryrefslogtreecommitdiff
path: root/plugin.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin.go')
-rw-r--r--plugin.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/plugin.go b/plugin.go
index 0a8f993..396829d 100644
--- a/plugin.go
+++ b/plugin.go
@@ -149,6 +149,15 @@ func searchPaths(name string) *aplug {
var pfile []byte
var err error
+ // try the filename from the command line first
+ if argGui.GuiFile != "" {
+ p := initToolkit(name, argGui.GuiFile)
+ if p != nil {
+ log.Log(NOW, "gui.Init() loaded ok!", argGui.GuiFile)
+ return p
+ }
+ }
+
// first try to load the embedded plugin file
// always try this first as it should have been
// tested by whomever compiled your binary
@@ -219,6 +228,17 @@ 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 {