代码拉取完成,页面将自动刷新
package main
import (
"fmt"
"gitee.com/mjun1833/delve/_fixtures/internal/pluginsupport"
"os"
"plugin"
)
type asomething struct {
n int
}
func (a *asomething) Callback(n int) int {
return a.n + n
}
func (a *asomething) String() string {
return "success"
}
var ExeGlobal = &asomething{2}
func must(err error) {
if err != nil {
panic(err)
}
}
func main() {
plug1, err := plugin.Open(os.Args[1])
must(err)
plug2, err := plugin.Open(os.Args[2])
must(err)
fn1iface, err := plug1.Lookup("HelloFn")
must(err)
fn2iface, err := plug2.Lookup("TypesTest")
must(err)
fn1 := fn1iface.(func(int) string)
fn2 := fn2iface.(func(pluginsupport.Something) pluginsupport.SomethingElse)
a := fn1(3)
b := fn2(&asomething{2})
fmt.Println(a, b, ExeGlobal)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。