go-qml / qml

QML support for the Go language
Other
1.96k stars 189 forks source link

sys/mman.h is not available under Windows #79

Closed neclepsio closed 9 years ago

neclepsio commented 10 years ago

sys/mman.h, which is required by SetupTesting, is not available under Windows using mingw. Maybe this project can help. The header is required by testing.go in v1-dev branch.

niemeyer commented 9 years ago

I think we can just call the underlying VirtualProtect on Windows. It's a single call, and is very close to what we do anyway. Do you want to give it a try? Don't worry about making it nice.. if you can just hack the code to replace mprotect by VirtualProtect and see whether it works, it'd already be a good help.

You can see how the arguments map in the mman-win32 project you referenced:

https://code.google.com/p/mman-win32/source/browse/trunk/mman.c#139

neclepsio commented 9 years ago

This is compilation log:

In file included from ..\gopkg.in\qml.v1\all.cpp:11:0: ..\gopkg.in\qml.v1\cpp/mmemwin.cpp: In function 'int mprotect(void*, size_t, int)': ..\gopkg.in\qml.v1\cpp/mmemwin.cpp:15:11: error: 'PAGE_READ' was not declared in this scope wprot = PAGE_READ;

I suppose you want to use PAGE_READONLY.

niemeyer commented 9 years ago

Sorry for the silly mistake. I haven't had a chance to test it in a Windows machine.

Can you please try again?

neclepsio commented 9 years ago

It works.

niemeyer commented 9 years ago

\o/