From 5f76f7d8579e96279e96d81eca0ea15802281919 Mon Sep 17 00:00:00 2001 From: Martin Stiemerling <mls.ietf@gmail.com> Date: Wed, 18 Nov 2020 10:15:12 +0100 Subject: [PATCH] Working SBILoader with Interface, but not correct interface yet --- nucleus/sbi-general.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/nucleus/sbi-general.go b/nucleus/sbi-general.go index 0795a6653..b55a3e16f 100644 --- a/nucleus/sbi-general.go +++ b/nucleus/sbi-general.go @@ -6,11 +6,12 @@ import ( "plugin" ) -type SBIGreeter interface { - SBIHello() +type SBIInterface interface { + Hello() string + AddClient() } -func SBILoader () { +func SBILoader () error { 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 @@ -21,21 +22,23 @@ func SBILoader () { } // loading the symbols - sbiModule, err := plug.Lookup("SBIGreeter") + sbiModule, err := plug.Lookup("SBIInterface") if err != nil { fmt.Println(err) os.Exit(1) } // Assert the loaded symbol - var sbigreeter SBIGreeter - sbigreeter, ok := sbiModule.(SBIGreeter) + var sbi SBIInterface + sbi, ok := sbiModule.(SBIInterface) if !ok { fmt.Println("unexpected type from module symbol") + fmt.Println(ok) os.Exit(1) } // use me! - sbigreeter.SBIHello() + fmt.Print(sbi.Hello()) + sbi.AddClient() } -- GitLab