Modification for making Foonathan memory compatible with UWP#80
Modification for making Foonathan memory compatible with UWP#80foonathan merged 5 commits intofoonathan:masterfrom
Conversation
VirtualAlloc to VirtualAllocFromApp so that it is compatible for both Windows Desktop and UWP (https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualallocfromapp).
|
Thank you. However, it seems that it breaks CI which tests it on older version of windows. Is there some check for UWP so you can switch to VirtualAllocFromApp conditionally? |
Added check for UWP so that older versions of Visual Studio can still work (see https://docs.microsoft.com/en-us/cpp/porting/how-to-use-existing-cpp-code-in-a-universal-windows-platform-app?view=vs-2019).
|
It looks the checks provided here should work I updated my repo and it seems that this time it didn't break CI. However, I need to test it again on whether a UWP compilation works. I will confirm it as soon as I can. |
As UWP app would just link to this program and given that the library depends on the build tools, the check on whether to use VirtualAlloc vs. VirtualAllocFromApp is on the Visual Studio compiler version (https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2019).
|
Ok, I completed the check and actually using the macros I mentioned last time wouldn't work. So the easiest way to deal with it is just to check the version of the VS compiler. Now that works also when the library is linked to a UWP app. So, given that it passes also the CI, I think this pull request can be merged. Thanks! |
|
Sorry, missed that you fixed this. Thanks! |
| if (CMAKE_CROSSCOMPILING) | ||
| # statically link when cross compiling so emulator doesn't need library paths | ||
| set_target_properties(foonathan_memory_node_size_debugger PROPERTIES LINK_FLAGS "-static") | ||
| set_target_properties(foonathan_memory_node_size_debugger PROPERTIES LINK_FLAGS "/WHOLEARCHIVE") |
There was a problem hiding this comment.
Should be fixed by the commit I've referenced below, please check and open an issue if it doesn't work.
Modifications to VirtualAlloc for Windows compilation, so that it is compatible with UWP. In particular:
VirtualAllocwas changed toVirtualAllocFromAppso that it is compatible for both Windows Desktop and UWP (https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualallocfromapp). In addition, in the CMakeLists.txt,-staticoption was changed to/wholearchiveas-staticdoes not work anymore (please see https://docs.microsoft.com/en-us/cpp/build/reference/linker-options?view=vs-2019).This has been tested on both current Visual Studio 2017 and 2019.