Skip to content
Snippets Groups Projects

Use SPF Viper for configuration

1 file
+ 41
0
Compare changes
  • Side-by-side
  • Inline
+ 41
0
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()
}
Loading