-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
any document for load compied binary? #29
Comments
this is my demo: func TestGoLoader(t *testing.T) {
linker, err := goloader.ReadObjs([]string{"custom_pro.o"}, []string{"custom"}, nil, goloader.WithForceTestRelocationEpilogues())
if err != nil {
t.Error(err)
return
}
run := "custom.Run"
symPtr := make(map[string]uintptr)
pkgSet := make(map[string]struct{})
err = goloader.RegSymbol(symPtr, pkgSet)
if err != nil {
t.Fatal(err)
}
codeModule, err := goloader.Load(linker, symPtr)
if err != nil {
t.Fatal(err)
}
runFuncPtr, ok := codeModule.Syms[run]
if !ok || runFuncPtr == 0 {
t.Fatalf("Load error! not find function: %s", run)
}
funcPtrContainer := (uintptr)(unsafe.Pointer(&runFuncPtr))
runFunc := *(*func(event *beat.Event) (*beat.Event, error))(unsafe.Pointer(&funcPtrContainer))
event := getEvent()
res, err := runFunc(event)
fmt.Println(res)
os.Stdout.Sync()
codeModule.Unload()
} which print:
|
The intended usage is as per the README. If you want to load precompiled packages, you can either set In this fork, you should use If you share some basic reproducing source code for |
I try to use this project with load compied binary like https://github.com/pkujhd/goloader's usage type like:
but faild, can you add any document?
The text was updated successfully, but these errors were encountered: