EDGEML-14552: Fix _WINDOWS macro usage; replace with standard _WIN32 - #96
Merged
Merged
Conversation
Problem solved by the commit pl_device_intf.cpp used the non-standard _WINDOWS macro to guard Windows-specific code paths. MSVC does not define _WINDOWS in all build configurations; the standard predefined macro is _WIN32. This caused compilation failures with EWDK 28000.1839 (VS 2026/v145) where _WINDOWS was not defined in the XDP build context. Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered Discovered during a full x64 stack build with EWDK 28000.1839. The stricter v145 compiler exposed the missing _WINDOWS definition, resulting in the Windows-only __func__ workaround and the unistd.h guard being applied incorrectly. The _WINDOWS macro is a legacy convention not guaranteed by the MSVC ABI. How problem was solved, alternative solutions (if any) and why they were rejected Replaced all _WINDOWS guards with _WIN32, which is always defined by MSVC on Windows targets regardless of subsystem or SDK version. An alternative of defining _WINDOWS in the build system was rejected as it would mask the root cause and create a non-standard dependency. Risks (if any) associated the changes in the commit None. _WIN32 is defined by MSVC for all Windows 32-bit and 64-bit targets and is the correct standard macro for this guard pattern. What has been tested and how, request additional testing if necessary Full x64 stack build with EWDK 28000.1839 completed successfully. Additional testing requested: ARM64 build verification. Documentation impact (if any) None. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: John Hoy <john.hoy@amd.com>
Contributor
Author
|
@jvillarre, after this PR is merged please help update xdp submodule in xrt. These changes are required to support VS 2026 with SDK/WDK 28000.1839 |
jvillarre
self-requested a review
July 22, 2026 14:55
jvillarre
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem solved by the commit
pl_device_intf.cpp used the non-standard _WINDOWS macro to guard Windows-specific code paths. MSVC does not define _WINDOWS in all build configurations; the standard predefined macro is _WIN32. This caused compilation failures with EWDK 28000.1839 (VS 2026/v145) where _WINDOWS was not defined in the XDP build context.
Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered Discovered during a full x64 stack build with EWDK 28000.1839. The stricter v145 compiler exposed the missing _WINDOWS definition, resulting in the Windows-only func workaround and the unistd.h guard being applied incorrectly. The _WINDOWS macro is a legacy convention not guaranteed by the MSVC ABI.
How problem was solved, alternative solutions (if any) and why they were rejected Replaced all _WINDOWS guards with _WIN32, which is always defined by MSVC on Windows targets regardless of subsystem or SDK version. An alternative of defining _WINDOWS in the build system was rejected as it would mask the root cause and create a non-standard dependency.
Risks (if any) associated the changes in the commit None. _WIN32 is defined by MSVC for all Windows 32-bit and 64-bit targets and is the correct standard macro for this guard pattern.
What has been tested and how, request additional testing if necessary Full x64 stack build with EWDK 28000.1839 completed successfully. Additional testing requested: ARM64 build verification.
Documentation impact (if any)
None.