all: remove dependencies on golang.org/x/sys (#271)
The example still has the dependency on golang.org/x/sys. Updates #270
- commit
- 5905af50730466425f56454a0491ae991d644beb
- author
- Hajime Hoshi · · 2024-08-22 13:03 UTC
- committer
- GitHub · · 2024-08-22 13:03 UTC
- parent
- ebc2d33
- signature
- GPG Unverified
B5690EEEBB952194The key is unknown - refs
- tag: v0.8.0-alpha.5
2 files · +6 -6
M internal/load/load_windows.go +5 -3
| @@ -3,13 +3,15 @@ | |||
| 3 | 3 | ||
| 4 | 4 | package load | |
| 5 | 5 | ||
| 6 | - | import "golang.org/x/sys/windows" | |
| 6 | + | import ( | |
| 7 | + | "syscall" | |
| 8 | + | ) | |
| 7 | 9 | ||
| 8 | 10 | func OpenLibrary(name string) (uintptr, error) { | |
| 9 | - | handle, err := windows.LoadLibrary(name) | |
| 11 | + | handle, err := syscall.LoadLibrary(name) | |
| 10 | 12 | return uintptr(handle), err | |
| 11 | 13 | } | |
| 12 | 14 | ||
| 13 | 15 | func OpenSymbol(lib uintptr, name string) (uintptr, error) { | |
| 14 | - | return windows.GetProcAddress(windows.Handle(lib), name) | |
| 16 | + | return syscall.GetProcAddress(syscall.Handle(lib), name) | |
| 15 | 17 | } | |
| @@ -3,13 +3,15 @@ | |||||
| 3 | 3 | ||||
| 4 | package load | 4 | package load | ||
| 5 | 5 | ||||
| 6 | - | import "golang.org/x/sys/windows" | 6 | + | import ( |
| 7 | + | "syscall" | |||
| 8 | + | ) | |||
| 7 | 9 | ||||
| 8 | func OpenLibrary(name string) (uintptr, error) { | 10 | func OpenLibrary(name string) (uintptr, error) { | ||
| 9 | - | handle, err := windows.LoadLibrary(name) | 11 | + | handle, err := syscall.LoadLibrary(name) |
| 10 | return uintptr(handle), err | 12 | return uintptr(handle), err | ||
| 11 | } | 13 | } | ||
| 12 | 14 | ||||
| 13 | func OpenSymbol(lib uintptr, name string) (uintptr, error) { | 15 | func OpenSymbol(lib uintptr, name string) (uintptr, error) { | ||
| 14 | - | return windows.GetProcAddress(windows.Handle(lib), name) | 16 | + | return syscall.GetProcAddress(syscall.Handle(lib), name) |
| 15 | } | 17 | } | ||
M syscall_windows.go +1 -3
| @@ -6,8 +6,6 @@ package purego | |||
| 6 | 6 | import ( | |
| 7 | 7 | "reflect" | |
| 8 | 8 | "syscall" | |
| 9 | - | ||
| 10 | - | "golang.org/x/sys/windows" | |
| 11 | 9 | ) | |
| 12 | 10 | ||
| 13 | 11 | var syscall15XABI0 uintptr | |
| @@ -44,5 +42,5 @@ func NewCallback(fn interface{}) uintptr { | |||
| 44 | 42 | } | |
| 45 | 43 | ||
| 46 | 44 | func loadSymbol(handle uintptr, name string) (uintptr, error) { | |
| 47 | - | return windows.GetProcAddress(windows.Handle(handle), name) | |
| 45 | + | return syscall.GetProcAddress(syscall.Handle(handle), name) | |
| 48 | 46 | } | |
| @@ -6,8 +6,6 @@ package purego | |||||
| 6 | import ( | 6 | import ( | ||
| 7 | "reflect" | 7 | "reflect" | ||
| 8 | "syscall" | 8 | "syscall" | ||
| 9 | - | ||||
| 10 | - | "golang.org/x/sys/windows" | |||
| 11 | ) | 9 | ) | ||
| 12 | 10 | ||||
| 13 | var syscall15XABI0 uintptr | 11 | var syscall15XABI0 uintptr | ||
| @@ -44,5 +42,5 @@ func NewCallback(fn interface{}) uintptr { | |||||
| 44 | } | 42 | } | ||
| 45 | 43 | ||||
| 46 | func loadSymbol(handle uintptr, name string) (uintptr, error) { | 44 | func loadSymbol(handle uintptr, name string) (uintptr, error) { | ||
| 47 | - | return windows.GetProcAddress(windows.Handle(handle), name) | 45 | + | return syscall.GetProcAddress(syscall.Handle(handle), name) |
| 48 | } | 46 | } | ||