Skip to content
Snippets Groups Projects
Commit 6dc97f27 authored by Martin Stiemerling's avatar Martin Stiemerling
Browse files

logic to load sbi plugins

parent 91f9af6e
No related branches found
No related tags found
4 merge requests!90Develop,!88Use SPF Viper for configuration,!85Draft: Resolve "Overhaul Architecture",!53V.0.1.0 Codename Threadbare
Pipeline #54596 passed with warnings
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()
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment