-
Notifications
You must be signed in to change notification settings - Fork 35
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
Support for Windows. #3
Comments
Similar issue with me. I think this is an issue with dependency offheap uses. https://github.com/tysonmote/gommap/pull/3/files |
I welcome PRs to improve portability. |
I went through the pull request https://github.com/tysonmote/gommap/pull/3/files which claims the support for the windows of gommap. I tried it and again got stucked in the offheap/malloc.go.
|
consts_win.go defines the MAP_SHARED, etc; so we just need a consts_posix.go that does the same and then have malloc.go use those constants instead of the syscall ones that vary between OS. The int vs syscall.Handle looks like a conversion problem that should be easy to solve by looking at the expected signature of Ftruncate, and converting to the correct type. |
//go:build windows or //go:build darwin || dragonfly || freebsd || linux || nacl || netbsd || openbsd || solaris You would have to have different implementations as well, since POSIX systems use flags such as these syscall.PROT_READ|syscall.PROT_WRITE,
syscall.MAP_ANONYMOUS|syscall.MAP_PRIVATE, while windows uses more like these kernel32 := windows.NewLazySystemDLL("kernel32.dll")
virtualAlloc := kernel32.NewProc("VirtualAlloc")
r1, _, err := virtualAlloc.Call(
0,
size,
uintptr(0x1000), // MEM_COMMIT
uintptr(0x04), // PAGE_READWRITE
) In general, that's how I'm implementing, my incomplete for now, memory allocator. Separate implementations for the syscalls for separate systems, as mmap is specific to POSIX. |
Worked well with Unix and Darwin. Need a support for windows as well.
The text was updated successfully, but these errors were encountered: