diff --git a/cmd/go-loader-test/plugin-manager.go b/cmd/go-loader-test/plugin-manager.go index 27e62a2..95c81aa 100644 --- a/cmd/go-loader-test/plugin-manager.go +++ b/cmd/go-loader-test/plugin-manager.go @@ -11,6 +11,10 @@ type AddSymbol interface { st() map[string]interface{} } +type myInt2 map[string]interface { + Symbol(a, b string) (interface{}, error) +} + type STR struct { ress func(a string, b string) (interface{}, error) } @@ -70,13 +74,18 @@ func PluginManager(params ...string) { panic(err) } // rst - switch Symbol := symbols2["Symbol"].(type) { + switch f2 := symbols2["Symbol"].(type) { + // rstrst case func(a, b string) (interface{}, error): // var mystruct SymbolPlugS var mystr STR - mystr.ress = Symbol + // var inter myInt + + mystr.ress = f2 + // inter = mystr.ress.(myInt) + // mystr.ress = Symbol // result, err := Im("a", "b") // if err != nil { @@ -92,6 +101,11 @@ func PluginManager(params ...string) { panic("Function signature was not what was expected") } + + // deneme := symbols2["Symbol"] + // var inter myInt = deneme.(myInt) + // inter.Symbol("st", "st") + // Symbol := symbols2["Symbol"] // if f, ok := Symbol.(func(a, b string) (interface{}, error)); ok { // // fmt.Println(HandlerType(f)("rst", "rstrtd")) @@ -101,18 +115,35 @@ func PluginManager(params ...string) { // for i, v := range symbols2 { // fmt.Println(i, v) // } - fmt.Println(&symbols2) - fmt.Println(symbols2) + // fmt.Println(&symbols2) + // fmt.Println(symbols2) + // fmt.Println() + // fmt.Println(symbols) + // fmt.Println(&symbols) + + defer func() { + err = module2.Unload() + if err != nil { + panic(err) + } + }() + + fmt.Println() + fmt.Println() + fmt.Println() + + var empt interface{} = symbols2 + var inter myInt = empt.(myInt) + // inter.Symbol("a", "b") + fmt.Println(inter) + fmt.Println(symbols2["Symbol"]) + + fmt.Println() + fmt.Println() fmt.Println() - fmt.Println(symbols) - fmt.Println(&symbols) - err = module2.Unload() - if err != nil { - panic(err) - } } -func printsymbol() { - +type myInt interface { + // Symbol(a, b string) (interface{}, error) }