I recently found that I could use CancelIo(), but not CancelIoEx(). I looked at winbase.d, and found that CancelIoEx() is wrapped with 'static if (_WIN32_WINNT > 0x600) (I'm on Windows 10, so this shouldn't have been an issue).
I looked at w32api.d where this enum is defined, and found a bunch of version statements that set __WIN32_WINNT based on your windows version. I put a pragma(msg) into Windows10 block and compiled, and nothing was printed. I then moved it into the fallback else block, and it printed. This indicates to me that this version if-else is not working as intended.
This version if-else is using version labels (like Windows10, Windows8_1, etc) that aren't listed in the docs. Are they real version labels that are actually supported? They don't seem to be working on my machine.
Fair warning, I'm running a relatively old version of D currently (2.072.1). But unless these version statements have been added recently (and the docs don't seem to indicate this), then this issue still exists.
Let me know if there's anything I can test or if any more details would be helpful.
Comment #1 by musicaljelly — 2018-03-24T21:36:59Z
After making a source change to work around this problem (by just manually setting _WIN32_WINNT to the correct value), I can now compile using CancelIoEx(), but it fails at the link step. This appears to be because D links against an older version of kernel32.lib. I updated it and ran it through coffimplib, and was able to successfully link and use CancelIoEx().
This means that even if the version statements in w32api.d are fixed, you'll need to link against the correct lib(s) to use newer functions. Does D support this at all right now? What's the right way a user should go about doing this that doesn't involve generating their own kernel32.lib?
Comment #2 by dfj1esp02 — 2018-03-26T09:43:54Z
To set minimal supported OS version to windows 10 compile with -version Windows10 option, it's a usual conditional compilation. To link with latest libs build with -m32mscoff option, recent installer downloads fresh import libraries.
Comment #3 by robert.schadek — 2024-12-07T13:38:09Z