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
Commits
6dc97f27
Commit
6dc97f27
authored
4 years ago
by
Martin Stiemerling
Browse files
Options
Downloads
Patches
Plain Diff
logic to load sbi plugins
parent
91f9af6e
Branches
Branches containing commit
Tags
Tags containing commit
4 merge requests
!90
Develop
,
!88
Use SPF Viper for configuration
,
!85
Draft: Resolve "Overhaul Architecture"
,
!53
V.0.1.0 Codename Threadbare
Pipeline
#54596
passed with warnings
4 years ago
Stage: test
Stage: deploy
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nucleus/sbi-general.go
+41
-0
41 additions, 0 deletions
nucleus/sbi-general.go
with
41 additions
and
0 deletions
nucleus/sbi-general.go
0 → 100644
+
41
−
0
View file @
6dc97f27
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
()
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment