forked from erigontech/erigon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "silkworm: use silkworm-go bindings (erigontech#8829)"
This reverts commit bc0b727.
- Loading branch information
Showing
20 changed files
with
757 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//go:build unix | ||
|
||
package silkworm | ||
|
||
/* | ||
#cgo LDFLAGS: -ldl | ||
#include <dlfcn.h> | ||
#include <stdlib.h> | ||
*/ | ||
import "C" | ||
|
||
import ( | ||
"fmt" | ||
"unsafe" | ||
) | ||
|
||
func OpenLibrary(dllPath string) (unsafe.Pointer, error) { | ||
cPath := C.CString(dllPath) | ||
defer C.free(unsafe.Pointer(cPath)) | ||
dllHandle := C.dlopen(cPath, C.RTLD_LAZY) | ||
if dllHandle == nil { | ||
err := C.GoString(C.dlerror()) | ||
return nil, fmt.Errorf("failed to load dynamic library %s: %s", dllPath, err) | ||
} | ||
return dllHandle, nil | ||
} | ||
|
||
func LoadFunction(dllHandle unsafe.Pointer, funcName string) (unsafe.Pointer, error) { | ||
cName := C.CString(funcName) | ||
defer C.free(unsafe.Pointer(cName)) | ||
funcPtr := C.dlsym(dllHandle, cName) | ||
if funcPtr == nil { | ||
err := C.GoString(C.dlerror()) | ||
return nil, fmt.Errorf("failed to find the %s function: %s", funcName, err) | ||
} | ||
return funcPtr, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//go:build windows | ||
|
||
package silkworm | ||
|
||
import ( | ||
"errors" | ||
"unsafe" | ||
) | ||
|
||
func OpenLibrary(dllPath string) (unsafe.Pointer, error) { | ||
return nil, errors.New("not implemented") | ||
} | ||
|
||
func LoadFunction(dllHandle unsafe.Pointer, funcName string) (unsafe.Pointer, error) { | ||
return nil, errors.New("not implemented") | ||
} |
Oops, something went wrong.