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
5f76f7d8
Commit
5f76f7d8
authored
4 years ago
by
Martin Stiemerling
Browse files
Options
Downloads
Patches
Plain Diff
Working SBILoader with Interface, but not correct interface yet
parent
bc777bcc
No related branches found
No related tags found
1 merge request
!75
Draft: Resolve "Create interfaces for internal data structure"
Pipeline
#54690
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
+10
-7
10 additions, 7 deletions
nucleus/sbi-general.go
with
10 additions
and
7 deletions
nucleus/sbi-general.go
+
10
−
7
View file @
5f76f7d8
...
...
@@ -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
(
"SBI
Greeter
"
)
sbiModule
,
err
:=
plug
.
Lookup
(
"SBI
Interface
"
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
os
.
Exit
(
1
)
}
// Assert the loaded symbol
var
sbi
greeter
SBIGreeter
sbi
greeter
,
ok
:=
sbiModule
.
(
SBI
Greeter
)
var
sbi
SBIInterface
sbi
,
ok
:=
sbiModule
.
(
SBI
Interface
)
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
()
}
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