diff --git a/nucleus/sbi-general.go b/nucleus/sbi-general.go new file mode 100644 index 0000000000000000000000000000000000000000..0795a665354292cd1a09e2051b84658f3607d72e --- /dev/null +++ b/nucleus/sbi-general.go @@ -0,0 +1,41 @@ +package nucleus + +import ( + "fmt" + "os" + "plugin" +) + +type SBIGreeter interface { + SBIHello() +} + +func SBILoader () { + modPath := "/Users/mls/go/src/code.fbi.h-da.de/cocsn/byowsbi/byowsbi.o" + + // open the so file that contains the SBI-plugin as step before loading the symbols + plug, err := plugin.Open(modPath) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + + // loading the symbols + sbiModule, err := plug.Lookup("SBIGreeter") + if err != nil { + fmt.Println(err) + os.Exit(1) + } + + // Assert the loaded symbol + var sbigreeter SBIGreeter + sbigreeter, ok := sbiModule.(SBIGreeter) + if !ok { + fmt.Println("unexpected type from module symbol") + os.Exit(1) + } + + // use me! + sbigreeter.SBIHello() +} +