Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
goSDN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
goSDN
Merge requests
!88
Use SPF Viper for configuration
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Use SPF Viper for configuration
68-burntsushi-toml-is-unmaintained
into
v.0.1.0-codename-threadbare
Overview
0
Commits
15
Pipelines
3
Changes
1
Merged
Ghost User
requested to merge
68-burntsushi-toml-is-unmaintained
into
v.0.1.0-codename-threadbare
4 years ago
Overview
0
Commits
15
Pipelines
3
Changes
1
Expand
Closes
#68 (closed)
Edited
4 years ago
by
Ghost User
0
0
Merge request reports
Viewing commit
6dc97f27
Prev
Next
Show latest version
1 file
+
41
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
6dc97f27
logic to load sbi plugins
· 6dc97f27
Martin Stiemerling
authored
4 years ago
nucleus/sbi-general.go
0 → 100644
+
41
−
0
Options
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