Skip to content
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

remove golang.org/x/sys from examples and therefore completely #270 #272

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/libc/main_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

package main

import "golang.org/x/sys/windows"
import "syscall"

func openLibrary(name string) (uintptr, error) {
handle, err := windows.LoadLibrary(name)
handle, err := syscall.LoadLibrary(name)
return uintptr(handle), err
}
15 changes: 7 additions & 8 deletions examples/window/main_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ package main

import (
"runtime"
"syscall"
"unsafe"

"golang.org/x/sys/windows"

"github.com/ebitengine/purego"
)

Expand Down Expand Up @@ -78,10 +77,10 @@ var (
)

func init() {
kernel32 := windows.NewLazySystemDLL("kernel32.dll").Handle()
kernel32 := uintptr(syscall.MustLoadDLL("kernel32.dll").Handle)
purego.RegisterLibFunc(&GetModuleHandle, kernel32, "GetModuleHandleW")

user32 := windows.NewLazySystemDLL("user32.dll").Handle()
user32 := uintptr(syscall.MustLoadDLL("user32.dll").Handle)
purego.RegisterLibFunc(&RegisterClassEx, user32, "RegisterClassExW")
purego.RegisterLibFunc(&CreateWindowEx, user32, "CreateWindowExW")
purego.RegisterLibFunc(&AdjustWindowRect, user32, "AdjustWindowRect")
Expand All @@ -96,15 +95,15 @@ func init() {
}

func main() {
className, err := windows.UTF16PtrFromString("Sample Window Class")
className, err := syscall.UTF16PtrFromString("Sample Window Class")
if err != nil {
panic(err)
}
inst := GetModuleHandle(className)

wc := WNDCLASSEX{
Size: uint32(unsafe.Sizeof(WNDCLASSEX{})),
WndProc: windows.NewCallback(wndProc),
WndProc: syscall.NewCallback(wndProc),
Instance: inst,
ClassName: className,
}
Expand All @@ -117,7 +116,7 @@ func main() {
Right: 320,
Bottom: 240,
}
title, err := windows.UTF16PtrFromString("My Title")
title, err := syscall.UTF16PtrFromString("My Title")
if err != nil {
panic(err)
}
Expand All @@ -130,7 +129,7 @@ func main() {
0, 0, inst, nil,
)
if hwnd == 0 {
panic(windows.GetLastError())
panic(syscall.GetLastError())
}

ShowWindow(hwnd, SW_SHOW)
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module github.com/ebitengine/purego

go 1.18

require golang.org/x/sys v0.23.0
2 changes: 0 additions & 2 deletions go.sum

This file was deleted.

Loading