add options to debug plugin load failures
This commit is contained in:
parent
4b08f57674
commit
10d4942e6c
1
argv.go
1
argv.go
|
@ -14,6 +14,7 @@ type ArgsGui struct {
|
||||||
NoGui bool `arg:"--no-gui" help:"ignore all these gui problems"`
|
NoGui bool `arg:"--no-gui" help:"ignore all these gui problems"`
|
||||||
GuiPlugin string `arg:"--gui" help:"Use this gui toolkit [andlabs,gocui,nocui,stdin]"`
|
GuiPlugin string `arg:"--gui" help:"Use this gui toolkit [andlabs,gocui,nocui,stdin]"`
|
||||||
GuiFile string `arg:"--gui-file" help:"Use a specific plugin.so file"`
|
GuiFile string `arg:"--gui-file" help:"Use a specific plugin.so file"`
|
||||||
|
GuiTest string `arg:"--gui-test" help:"test a specific plugin.so will load"`
|
||||||
GuiVerbose bool `arg:"--gui-verbose" help:"enable all logging"`
|
GuiVerbose bool `arg:"--gui-verbose" help:"enable all logging"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
init.go
3
init.go
|
@ -281,6 +281,9 @@ func New() *Node {
|
||||||
// trapStdout()
|
// trapStdout()
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
if argGui.GuiTest != "" {
|
||||||
|
testPlugin()
|
||||||
|
}
|
||||||
|
|
||||||
initNew()
|
initNew()
|
||||||
return me.rootNode
|
return me.rootNode
|
||||||
|
|
20
plugin.go
20
plugin.go
|
@ -149,6 +149,15 @@ func searchPaths(name string) *aplug {
|
||||||
var pfile []byte
|
var pfile []byte
|
||||||
var err error
|
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
|
// first try to load the embedded plugin file
|
||||||
// always try this first as it should have been
|
// always try this first as it should have been
|
||||||
// tested by whomever compiled your binary
|
// tested by whomever compiled your binary
|
||||||
|
@ -219,6 +228,17 @@ func searchPaths(name string) *aplug {
|
||||||
return nil
|
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
|
// load module
|
||||||
// 1. open the shared object file to load the symbols
|
// 1. open the shared object file to load the symbols
|
||||||
func initToolkit(name string, filename string) *aplug {
|
func initToolkit(name string, filename string) *aplug {
|
||||||
|
|
Loading…
Reference in New Issue